Merge branch 'develop' into xiaoping/add_test_case
This commit is contained in:
commit
142f936692
|
@ -108,7 +108,8 @@ mkdir debug && cd debug
|
||||||
cmake .. && cmake --build .
|
cmake .. && cmake --build .
|
||||||
```
|
```
|
||||||
|
|
||||||
To compile on an ARM processor (aarch64 or aarch32), please add option CPUTYPE as below:
|
TDengine build script can detect the host machine's architecture on X86-64, X86, arm64 and arm32 platform.
|
||||||
|
You can also specify CPUTYPE option like aarch64 or aarch32 too if the detection result is not correct:
|
||||||
|
|
||||||
aarch64:
|
aarch64:
|
||||||
```bash
|
```bash
|
||||||
|
|
|
@ -78,29 +78,58 @@ ELSE()
|
||||||
EXIT ()
|
EXIT ()
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
# if generate ARM version:
|
IF ("${CPUTYPE}" STREQUAL "")
|
||||||
# cmake -DCPUTYPE=aarch32 .. or cmake -DCPUTYPE=aarch64
|
MESSAGE(STATUS "The current platform " ${CMAKE_SYSTEM_PROCESSOR} " is detected")
|
||||||
IF (${CPUTYPE} MATCHES "aarch32")
|
|
||||||
|
IF (CMAKE_SYSTEM_PROCESSOR MATCHES "(amd64)|(AMD64)")
|
||||||
|
MESSAGE(STATUS "The current platform is amd64")
|
||||||
|
MESSAGE(STATUS "Set CPUTYPE to x64")
|
||||||
|
SET(CPUTYPE "x64")
|
||||||
|
ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)")
|
||||||
|
MESSAGE(STATUS "The current platform is x86")
|
||||||
|
MESSAGE(STATUS "Set CPUTYPE to x86")
|
||||||
|
SET(CPUTYPE "x32")
|
||||||
|
ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "armv7l")
|
||||||
|
MESSAGE(STATUS "Set CPUTYPE to aarch32")
|
||||||
|
SET(CPUTYPE "aarch32")
|
||||||
|
MESSAGE(STATUS "Set CPUTYPE to aarch32")
|
||||||
|
SET(TD_LINUX TRUE)
|
||||||
|
SET(TD_LINUX_32 FALSE)
|
||||||
|
SET(TD_ARM_32 TRUE)
|
||||||
|
ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
|
||||||
|
SET(CPUTYPE "aarch64")
|
||||||
|
MESSAGE(STATUS "Set CPUTYPE to aarch64")
|
||||||
|
SET(TD_LINUX TRUE)
|
||||||
|
SET(TD_LINUX_64 FALSE)
|
||||||
|
SET(TD_ARM_64 TRUE)
|
||||||
|
ENDIF ()
|
||||||
|
|
||||||
|
ELSE ()
|
||||||
|
# if generate ARM version:
|
||||||
|
# cmake -DCPUTYPE=aarch32 .. or cmake -DCPUTYPE=aarch64
|
||||||
|
IF (${CPUTYPE} MATCHES "aarch32")
|
||||||
SET(TD_LINUX TRUE)
|
SET(TD_LINUX TRUE)
|
||||||
SET(TD_LINUX_32 FALSE)
|
SET(TD_LINUX_32 FALSE)
|
||||||
SET(TD_ARM_32 TRUE)
|
SET(TD_ARM_32 TRUE)
|
||||||
MESSAGE(STATUS "input cpuType: aarch32")
|
MESSAGE(STATUS "input cpuType: aarch32")
|
||||||
ELSEIF (${CPUTYPE} MATCHES "aarch64")
|
ELSEIF (${CPUTYPE} MATCHES "aarch64")
|
||||||
SET(TD_LINUX TRUE)
|
SET(TD_LINUX TRUE)
|
||||||
SET(TD_LINUX_64 FALSE)
|
SET(TD_LINUX_64 FALSE)
|
||||||
SET(TD_ARM_64 TRUE)
|
SET(TD_ARM_64 TRUE)
|
||||||
MESSAGE(STATUS "input cpuType: aarch64")
|
MESSAGE(STATUS "input cpuType: aarch64")
|
||||||
ELSEIF (${CPUTYPE} MATCHES "mips64")
|
ELSEIF (${CPUTYPE} MATCHES "mips64")
|
||||||
SET(TD_LINUX TRUE)
|
SET(TD_LINUX TRUE)
|
||||||
SET(TD_LINUX_64 FALSE)
|
SET(TD_LINUX_64 FALSE)
|
||||||
SET(TD_MIPS_64 TRUE)
|
SET(TD_MIPS_64 TRUE)
|
||||||
MESSAGE(STATUS "input cpuType: mips64")
|
MESSAGE(STATUS "input cpuType: mips64")
|
||||||
ELSEIF (${CPUTYPE} MATCHES "x64")
|
ELSEIF (${CPUTYPE} MATCHES "x64")
|
||||||
MESSAGE(STATUS "input cpuType: x64")
|
MESSAGE(STATUS "input cpuType: x64")
|
||||||
ELSEIF (${CPUTYPE} MATCHES "x86")
|
ELSEIF (${CPUTYPE} MATCHES "x86")
|
||||||
MESSAGE(STATUS "input cpuType: x86")
|
MESSAGE(STATUS "input cpuType: x86")
|
||||||
ELSE ()
|
ELSE ()
|
||||||
MESSAGE(STATUS "input cpuType unknown " ${CPUTYPE})
|
MESSAGE(STATUS "input cpuType unknown " ${CPUTYPE})
|
||||||
|
ENDIF ()
|
||||||
|
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
# cmake -DOSTYPE=Ningsi
|
# cmake -DOSTYPE=Ningsi
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html><html lang='en'><head><title>Documentation | Taos Data</title><meta name='description' content='TDengine is an open-source big data platform for IoT. Along with a 10x faster time-series database, it provides caching, stream computing, message queuing, and other functionalities. It is designed and optimized for Internet of Things, Connected Cars, and Industrial IoT. Read the documentation for TDengine here to get started right away.'><meta name='keywords' content='TDengine, Big Data, Open Source, IoT, Connected Cars, Industrial IoT, time-series database, caching, stream computing, message queuing, IT infrastructure monitoring, application performance monitoring, Internet of Things,TAOS Data, Documentation, programming, coding, syntax, frequently asked questions, questions, faq'><meta name='title' content='Documentation | Taos Data'><meta property='og:site_name' content='Taos Data'/><meta property='og:title' content='Documentation | Taos Data'/><meta property='og:type' content='article'/><meta property='og:url' content='https://www.taosdata.com/en/documentation/faq/index.php'/><meta property='og:description' content='TDengine is an open-source big data platform for IoT. Along with a 10x faster time-series database, it provides caching, stream computing, message queuing, and other functionalities. It is designed and optimized for Internet of Things, Connected Cars, and Industrial IoT. Read the documentation for TDengine here to get started right away.' /><link rel='canonical' href='https://www.taosdata.com/en/documentation/faq/index.php'/><script src='../lib/jquery-3.4.1.min.js' type='application/javascript'></script><link href='../lib/bootstrap.min.css' rel='stylesheet'><link href='../styles/base.min.css' rel='stylesheet'><link rel='stylesheet' href='../lib/docs/taosdataprettify.css'><link rel='stylesheet' href='../lib/docs/docs.css'><script src='../lib/docs/prettify.js'></script><script src='../lib/docs/prettyprint-sql.js'></script></head><body><script>$('#documentation-href').addClass('active')</script><div class='container-fluid'><main class='content-wrapper'><section class='documentation'><a href='../index.html'>Back</a><h1>FAQ</h1>
|
<!DOCTYPE html><html lang='en'><head><title>Documentation | Taos Data</title><meta name='description' content='TDengine is an open-source big data platform for IoT. Along with a 10x faster time-series database, it provides caching, stream computing, message queuing, and other functionalities. It is designed and optimized for Internet of Things, Connected Cars, and Industrial IoT. Read the documentation for TDengine here to get started right away.'><meta name='keywords' content='TDengine, Big Data, Open Source, IoT, Connected Cars, Industrial IoT, time-series database, caching, stream computing, message queuing, IT infrastructure monitoring, application performance monitoring, Internet of Things,TAOS Data, Documentation, programming, coding, syntax, frequently asked questions, questions, faq'><meta name='title' content='Documentation | Taos Data'><meta property='og:site_name' content='Taos Data'/><meta property='og:title' content='Documentation | Taos Data'/><meta property='og:type' content='article'/><meta property='og:url' content='https://www.taosdata.com/en/documentation/faq/index.php'/><meta property='og:description' content='TDengine is an open-source big data platform for IoT. Along with a 10x faster time-series database, it provides caching, stream computing, message queuing, and other functionalities. It is designed and optimized for Internet of Things, Connected Cars, and Industrial IoT. Read the documentation for TDengine here to get started right away.' /><link rel='canonical' href='https://www.taosdata.com/en/documentation/faq/index.php'/><script src='../lib/jquery-3.4.1.min.js' type='application/javascript'></script><link href='../lib/bootstrap.min.css' rel='stylesheet'><link href='../styles/base.min.css' rel='stylesheet'><link rel='stylesheet' href='../lib/docs/taosdataprettify.css'><link rel='stylesheet' href='../lib/docs/docs.css'><script src='../lib/docs/prettify.js'></script><script src='../lib/docs/prettyprint-sql.js'></script></head><body><script>$('#documentation-href').addClass('active')</script><div class='container-fluid'><main class='content-wrapper'><section class='documentation'><a href='../index.html'>Back</a><h1>FAQ</h1>
|
||||||
<h4>1. When encoutered with the error "failed to connect to server", what can I do?</h4>
|
<h4>1. When encountered with the error "failed to connect to server", what can I do?</h4>
|
||||||
<p>The client may encounter connection errors. Please follow the steps below for troubleshooting:</p>
|
<p>The client may encounter connection errors. Please follow the steps below for troubleshooting:</p>
|
||||||
<ol>
|
<ol>
|
||||||
<li>On the server side, execute <code>systemctl status taosd</code> to check the status of <em>taosd</em> service. If <em>taosd</em> is not running, start it and retry connecting.</li>
|
<li>On the server side, execute <code>systemctl status taosd</code> to check the status of <em>taosd</em> service. If <em>taosd</em> is not running, start it and retry connecting.</li>
|
||||||
|
|
|
@ -119,6 +119,7 @@ TDengine是一个高效的存储、查询、分析时序大数据的平台,专
|
||||||
* [TDengine样例导入工具](https://www.taosdata.com/blog/2020/01/18/1166.html)
|
* [TDengine样例导入工具](https://www.taosdata.com/blog/2020/01/18/1166.html)
|
||||||
* [TDengine性能对比测试工具](https://www.taosdata.com/blog/2020/01/18/1166.html)
|
* [TDengine性能对比测试工具](https://www.taosdata.com/blog/2020/01/18/1166.html)
|
||||||
* [IDEA数据库管理工具可视化使用TDengine](https://www.taosdata.com/blog/2020/08/27/1767.html)
|
* [IDEA数据库管理工具可视化使用TDengine](https://www.taosdata.com/blog/2020/08/27/1767.html)
|
||||||
|
* [基于eletron开发的跨平台TDengine图形化管理工具](https://github.com/skye0207/TDengineGUI)
|
||||||
|
|
||||||
## TDengine与其他数据库的对比测试
|
## TDengine与其他数据库的对比测试
|
||||||
|
|
||||||
|
|
|
@ -182,11 +182,11 @@ TDengine 分布式架构的逻辑结构图如下:
|
||||||
|
|
||||||
**集群对外连接:** TDengine集群可以容纳单个、多个甚至几千个数据节点。应用只需要向集群中任何一个数据节点发起连接即可,连接需要提供的网络参数是一数据节点的End Point(FQDN加配置的端口号)。通过命令行CLI启动应用taos时,可以通过选项-h来指定数据节点的FQDN, -P来指定其配置的端口号,如果端口不配置,将采用TDengine的系统配置参数serverPort。
|
**集群对外连接:** TDengine集群可以容纳单个、多个甚至几千个数据节点。应用只需要向集群中任何一个数据节点发起连接即可,连接需要提供的网络参数是一数据节点的End Point(FQDN加配置的端口号)。通过命令行CLI启动应用taos时,可以通过选项-h来指定数据节点的FQDN, -P来指定其配置的端口号,如果端口不配置,将采用TDengine的系统配置参数serverPort。
|
||||||
|
|
||||||
**集群内部通讯**: 各个数据节点之间通过TCP/UDP进行连接。一个数据节点启动时,将获取mnode所在的dnode的EP信息,然后与系统中的mnode建立起连接,交换信息。获取mnode的EP信息有三步,1:检查mnodeEpList文件是否存在,如果不存在或不能正常打开获得mnode EP信息,进入第二步;2:检查系统配置文件taos.cfg, 获取节点配置参数first, second,(这两个参数指定的节点可以是不带mnode的普通节点,这样的话,节点被连接时会尝试重定向到mnode节点)如果不存在或者taos.cfg里没有这两个配置参数,或无效,进入第三步;3:将自己的EP设为mnode EP, 并独立运行起来。获取mnode EP列表后,数据节点发起连接,如果连接成功,则成功加入进工作的集群,如果不成功,则尝试mnode EP列表中的下一个。如果都尝试了,但连接都仍然失败,则休眠几秒后,再进行尝试。
|
**集群内部通讯**: 各个数据节点之间通过TCP/UDP进行连接。一个数据节点启动时,将获取mnode所在的dnode的EP信息,然后与系统中的mnode建立起连接,交换信息。获取mnode的EP信息有三步,1:检查mnodeEpList文件是否存在,如果不存在或不能正常打开获得mnode EP信息,进入第二步;2:检查系统配置文件taos.cfg, 获取节点配置参数firstEp, secondEp,(这两个参数指定的节点可以是不带mnode的普通节点,这样的话,节点被连接时会尝试重定向到mnode节点)如果不存在或者taos.cfg里没有这两个配置参数,或无效,进入第三步;3:将自己的EP设为mnode EP, 并独立运行起来。获取mnode EP列表后,数据节点发起连接,如果连接成功,则成功加入进工作的集群,如果不成功,则尝试mnode EP列表中的下一个。如果都尝试了,但连接都仍然失败,则休眠几秒后,再进行尝试。
|
||||||
|
|
||||||
**MNODE的选择:** TDengine逻辑上有管理节点,但没有单独的执行代码,服务器侧只有一套执行代码taosd。那么哪个数据节点会是管理节点呢?这是系统自动决定的,无需任何人工干预。原则如下:一个数据节点启动时,会检查自己的End Point, 并与获取的mnode EP List进行比对,如果在其中,该数据节点认为自己应该启动mnode模块,成为mnode。如果自己的EP不在mnode EP List里,则不启动mnode模块。在系统的运行过程中,由于负载均衡、宕机等原因,mnode有可能迁移至新的dnode,但一切都是透明的,无需人工干预,配置参数的修改,是mnode自己根据资源做出的决定。
|
**MNODE的选择:** TDengine逻辑上有管理节点,但没有单独的执行代码,服务器侧只有一套执行代码taosd。那么哪个数据节点会是管理节点呢?这是系统自动决定的,无需任何人工干预。原则如下:一个数据节点启动时,会检查自己的End Point, 并与获取的mnode EP List进行比对,如果在其中,该数据节点认为自己应该启动mnode模块,成为mnode。如果自己的EP不在mnode EP List里,则不启动mnode模块。在系统的运行过程中,由于负载均衡、宕机等原因,mnode有可能迁移至新的dnode,但一切都是透明的,无需人工干预,配置参数的修改,是mnode自己根据资源做出的决定。
|
||||||
|
|
||||||
**新数据节点的加入**:系统有了一个数据节点后,就已经成为一个工作的系统。添加新的节点进集群时,有两个步骤,第一步:使用TDengine CLI连接到现有工作的数据节点,然后用命令”create dnode"将新的数据节点的End Point添加进去; 第二步:在新的数据节点的系统配置参数文件taos.cfg里,将first, second参数设置为现有集群中任意两个数据节点的EP即可。具体添加的详细步骤请见详细的用户手册。这样就把集群一步一步的建立起来。
|
**新数据节点的加入**:系统有了一个数据节点后,就已经成为一个工作的系统。添加新的节点进集群时,有两个步骤,第一步:使用TDengine CLI连接到现有工作的数据节点,然后用命令”create dnode"将新的数据节点的End Point添加进去; 第二步:在新的数据节点的系统配置参数文件taos.cfg里,将firstEp, secondEp参数设置为现有集群中任意两个数据节点的EP即可。具体添加的详细步骤请见详细的用户手册。这样就把集群一步一步的建立起来。
|
||||||
|
|
||||||
**重定向**:无论是dnode还是taosc,最先都是要发起与mnode的连接,但mnode是系统自动创建并维护的,因此对于用户来说,并不知道哪个dnode在运行mnode。TDengine只要求向系统中任何一个工作的dnode发起连接即可。因为任何一个正在运行的dnode,都维护有目前运行的mnode EP List。当收到一个来自新启动的dnode或taosc的连接请求,如果自己不是mnode,则将mnode EP List回复给对方,taosc或新启动的dnode收到这个list, 就重新尝试建立连接。当mnode EP List发生改变,通过节点之间的消息交互,各个数据节点就很快获取最新列表,并通知taosc。
|
**重定向**:无论是dnode还是taosc,最先都是要发起与mnode的连接,但mnode是系统自动创建并维护的,因此对于用户来说,并不知道哪个dnode在运行mnode。TDengine只要求向系统中任何一个工作的dnode发起连接即可。因为任何一个正在运行的dnode,都维护有目前运行的mnode EP List。当收到一个来自新启动的dnode或taosc的连接请求,如果自己不是mnode,则将mnode EP List回复给对方,taosc或新启动的dnode收到这个list, 就重新尝试建立连接。当mnode EP List发生改变,通过节点之间的消息交互,各个数据节点就很快获取最新列表,并通知taosc。
|
||||||
|
|
||||||
|
|
|
@ -726,7 +726,7 @@ HTTP请求URL采用`sqlutc`时,返回结果集的时间戳将采用UTC时间
|
||||||
下面仅列出一些与RESTful接口有关的配置参数,其他系统参数请看配置文件里的说明。注意:配置修改后,需要重启taosd服务才能生效
|
下面仅列出一些与RESTful接口有关的配置参数,其他系统参数请看配置文件里的说明。注意:配置修改后,需要重启taosd服务才能生效
|
||||||
|
|
||||||
- httpPort: 对外提供RESTful服务的端口号,默认绑定到6041
|
- httpPort: 对外提供RESTful服务的端口号,默认绑定到6041
|
||||||
- httpMaxThreads: 启动的线程数量,默认为2
|
- httpMaxThreads: 启动的线程数量,默认为2(2.0.17版本开始,默认值改为CPU核数的一半向下取整)
|
||||||
- restfulRowLimit: 返回结果集(JSON格式)的最大条数,默认值为10240
|
- restfulRowLimit: 返回结果集(JSON格式)的最大条数,默认值为10240
|
||||||
- httpEnableCompress: 是否支持压缩,默认不支持,目前TDengine仅支持gzip压缩格式
|
- httpEnableCompress: 是否支持压缩,默认不支持,目前TDengine仅支持gzip压缩格式
|
||||||
- httpDebugFlag: 日志开关,131:仅错误和报警信息,135:调试信息,143:非常详细的调试信息,默认131
|
- httpDebugFlag: 日志开关,131:仅错误和报警信息,135:调试信息,143:非常详细的调试信息,默认131
|
||||||
|
|
|
@ -96,11 +96,11 @@ TDengine 目前尚不支持删除功能,未来根据用户需求可能会支
|
||||||
|
|
||||||
使用2.0及其以上版本,默认支持1024列;2.0之前的版本,TDengine最大允许创建250列的表。但是如果确实超过限值,建议按照数据特性,逻辑地将这个宽表分解成几个小表。
|
使用2.0及其以上版本,默认支持1024列;2.0之前的版本,TDengine最大允许创建250列的表。但是如果确实超过限值,建议按照数据特性,逻辑地将这个宽表分解成几个小表。
|
||||||
|
|
||||||
## 10. 最有效的写入数据的方法是什么?
|
## 11. 最有效的写入数据的方法是什么?
|
||||||
|
|
||||||
批量插入。每条写入语句可以一张表同时插入多条记录,也可以同时插入多张表的多条记录。
|
批量插入。每条写入语句可以一张表同时插入多条记录,也可以同时插入多张表的多条记录。
|
||||||
|
|
||||||
## 11. 最有效的写入数据的方法是什么?windows系统下插入的nchar类数据中的汉字被解析成了乱码如何解决?
|
## 12. 最有效的写入数据的方法是什么?windows系统下插入的nchar类数据中的汉字被解析成了乱码如何解决?
|
||||||
|
|
||||||
Windows下插入nchar类的数据中如果有中文,请先确认系统的地区设置成了中国(在Control Panel里可以设置),这时cmd中的`taos`客户端应该已经可以正常工作了;如果是在IDE里开发Java应用,比如Eclipse, Intellij,请确认IDE里的文件编码为GBK(这是Java默认的编码类型),然后在生成Connection时,初始化客户端的配置,具体语句如下:
|
Windows下插入nchar类的数据中如果有中文,请先确认系统的地区设置成了中国(在Control Panel里可以设置),这时cmd中的`taos`客户端应该已经可以正常工作了;如果是在IDE里开发Java应用,比如Eclipse, Intellij,请确认IDE里的文件编码为GBK(这是Java默认的编码类型),然后在生成Connection时,初始化客户端的配置,具体语句如下:
|
||||||
```JAVA
|
```JAVA
|
||||||
|
@ -110,7 +110,7 @@ properties.setProperty(TSDBDriver.LOCALE_KEY, "UTF-8");
|
||||||
Connection = DriverManager.getConnection(url, properties);
|
Connection = DriverManager.getConnection(url, properties);
|
||||||
```
|
```
|
||||||
|
|
||||||
## 12.JDBC报错: the excuted SQL is not a DML or a DDL?
|
## 13.JDBC报错: the excuted SQL is not a DML or a DDL?
|
||||||
|
|
||||||
请更新至最新的JDBC驱动
|
请更新至最新的JDBC驱动
|
||||||
```JAVA
|
```JAVA
|
||||||
|
@ -121,15 +121,15 @@ Connection = DriverManager.getConnection(url, properties);
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
## 13. taos connect failed, reason: invalid timestamp
|
## 14. taos connect failed, reason: invalid timestamp
|
||||||
|
|
||||||
常见原因是服务器和客户端时间没有校准,可以通过和时间服务器同步的方式(Linux 下使用 ntpdate 命令,Windows 在系统时间设置中选择自动同步)校准。
|
常见原因是服务器和客户端时间没有校准,可以通过和时间服务器同步的方式(Linux 下使用 ntpdate 命令,Windows 在系统时间设置中选择自动同步)校准。
|
||||||
|
|
||||||
## 14. 表名显示不全
|
## 15. 表名显示不全
|
||||||
|
|
||||||
由于 taos shell 在终端中显示宽度有限,有可能比较长的表名显示不全,如果按照显示的不全的表名进行相关操作会发生 Table does not exist 错误。解决方法可以是通过修改 taos.cfg 文件中的设置项 maxBinaryDisplayWidth, 或者直接输入命令 set max_binary_display_width 100。或者在命令结尾使用 \G 参数来调整结果的显示方式。
|
由于 taos shell 在终端中显示宽度有限,有可能比较长的表名显示不全,如果按照显示的不全的表名进行相关操作会发生 Table does not exist 错误。解决方法可以是通过修改 taos.cfg 文件中的设置项 maxBinaryDisplayWidth, 或者直接输入命令 set max_binary_display_width 100。或者在命令结尾使用 \G 参数来调整结果的显示方式。
|
||||||
|
|
||||||
## 15. 如何进行数据迁移?
|
## 16. 如何进行数据迁移?
|
||||||
|
|
||||||
TDengine是根据hostname唯一标志一台机器的,在数据文件从机器A移动机器B时,注意如下两件事:
|
TDengine是根据hostname唯一标志一台机器的,在数据文件从机器A移动机器B时,注意如下两件事:
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ TDengine是根据hostname唯一标志一台机器的,在数据文件从机器A
|
||||||
- 2.0.7.0 及以后的版本,到/var/lib/taos/dnode下,修复dnodeEps.json的dnodeId对应的FQDN,重启。确保机器内所有机器的此文件是完全相同的。
|
- 2.0.7.0 及以后的版本,到/var/lib/taos/dnode下,修复dnodeEps.json的dnodeId对应的FQDN,重启。确保机器内所有机器的此文件是完全相同的。
|
||||||
- 1.x 和 2.x 版本的存储结构不兼容,需要使用迁移工具或者自己开发应用导出导入数据。
|
- 1.x 和 2.x 版本的存储结构不兼容,需要使用迁移工具或者自己开发应用导出导入数据。
|
||||||
|
|
||||||
## 16. 如何在命令行程序 taos 中临时调整日志级别
|
## 17. 如何在命令行程序 taos 中临时调整日志级别
|
||||||
|
|
||||||
为了调试方便,从 2.0.16 版本开始,命令行程序 taos 新增了与日志记录相关的两条指令:
|
为了调试方便,从 2.0.16 版本开始,命令行程序 taos 新增了与日志记录相关的两条指令:
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,8 @@ WORKDIR /root/${dirName}/
|
||||||
RUN /bin/bash install.sh -e no
|
RUN /bin/bash install.sh -e no
|
||||||
|
|
||||||
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib"
|
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib"
|
||||||
ENV LANG=en_US.UTF-8
|
ENV LANG=C.UTF-8
|
||||||
ENV LANGUAGE=en_US:en
|
ENV LC_ALL=C.UTF-8
|
||||||
ENV LC_ALL=en_US.UTF-8
|
|
||||||
EXPOSE 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042
|
EXPOSE 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042
|
||||||
CMD ["taosd"]
|
CMD ["taosd"]
|
||||||
VOLUME [ "/var/lib/taos", "/var/log/taos","/etc/taos/" ]
|
VOLUME [ "/var/lib/taos", "/var/log/taos","/etc/taos/" ]
|
||||||
|
|
|
@ -270,7 +270,7 @@ void tscPrintSelectClause(SSqlObj* pSql, int32_t subClauseIndex);
|
||||||
bool hasMoreVnodesToTry(SSqlObj *pSql);
|
bool hasMoreVnodesToTry(SSqlObj *pSql);
|
||||||
bool hasMoreClauseToTry(SSqlObj* pSql);
|
bool hasMoreClauseToTry(SSqlObj* pSql);
|
||||||
|
|
||||||
void tscFreeQueryInfo(SSqlCmd* pCmd);
|
void tscFreeQueryInfo(SSqlCmd* pCmd, bool removeMeta);
|
||||||
|
|
||||||
void tscTryQueryNextVnode(SSqlObj *pSql, __async_cb_func_t fp);
|
void tscTryQueryNextVnode(SSqlObj *pSql, __async_cb_func_t fp);
|
||||||
void tscAsyncQuerySingleRowForNextVnode(void *param, TAOS_RES *tres, int numOfRows);
|
void tscAsyncQuerySingleRowForNextVnode(void *param, TAOS_RES *tres, int numOfRows);
|
||||||
|
|
|
@ -442,6 +442,8 @@ void tscCloseTscObj(void *pObj);
|
||||||
TAOS *taos_connect_a(char *ip, char *user, char *pass, char *db, uint16_t port, void (*fp)(void *, TAOS_RES *, int),
|
TAOS *taos_connect_a(char *ip, char *user, char *pass, char *db, uint16_t port, void (*fp)(void *, TAOS_RES *, int),
|
||||||
void *param, TAOS **taos);
|
void *param, TAOS **taos);
|
||||||
TAOS_RES* taos_query_h(TAOS* taos, const char *sqlstr, int64_t* res);
|
TAOS_RES* taos_query_h(TAOS* taos, const char *sqlstr, int64_t* res);
|
||||||
|
TAOS_RES * taos_query_ra(TAOS *taos, const char *sqlstr, __async_cb_func_t fp, void *param);
|
||||||
|
|
||||||
void waitForQueryRsp(void *param, TAOS_RES *tres, int code);
|
void waitForQueryRsp(void *param, TAOS_RES *tres, int code);
|
||||||
|
|
||||||
void doAsyncQuery(STscObj *pObj, SSqlObj *pSql, __async_cb_func_t fp, void *param, const char *sqlstr, size_t sqlLen);
|
void doAsyncQuery(STscObj *pObj, SSqlObj *pSql, __async_cb_func_t fp, void *param, const char *sqlstr, size_t sqlLen);
|
||||||
|
|
|
@ -74,12 +74,16 @@ void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, __async_cb_func_t fp, void* para
|
||||||
|
|
||||||
// TODO return the correct error code to client in tscQueueAsyncError
|
// TODO return the correct error code to client in tscQueueAsyncError
|
||||||
void taos_query_a(TAOS *taos, const char *sqlstr, __async_cb_func_t fp, void *param) {
|
void taos_query_a(TAOS *taos, const char *sqlstr, __async_cb_func_t fp, void *param) {
|
||||||
|
taos_query_ra(taos, sqlstr, fp, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
TAOS_RES * taos_query_ra(TAOS *taos, const char *sqlstr, __async_cb_func_t fp, void *param) {
|
||||||
STscObj *pObj = (STscObj *)taos;
|
STscObj *pObj = (STscObj *)taos;
|
||||||
if (pObj == NULL || pObj->signature != pObj) {
|
if (pObj == NULL || pObj->signature != pObj) {
|
||||||
tscError("bug!!! pObj:%p", pObj);
|
tscError("bug!!! pObj:%p", pObj);
|
||||||
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||||
tscQueueAsyncError(fp, param, TSDB_CODE_TSC_DISCONNECTED);
|
tscQueueAsyncError(fp, param, TSDB_CODE_TSC_DISCONNECTED);
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t sqlLen = (int32_t)strlen(sqlstr);
|
int32_t sqlLen = (int32_t)strlen(sqlstr);
|
||||||
|
@ -87,7 +91,7 @@ void taos_query_a(TAOS *taos, const char *sqlstr, __async_cb_func_t fp, void *pa
|
||||||
tscError("sql string exceeds max length:%d", tsMaxSQLStringLen);
|
tscError("sql string exceeds max length:%d", tsMaxSQLStringLen);
|
||||||
terrno = TSDB_CODE_TSC_EXCEED_SQL_LIMIT;
|
terrno = TSDB_CODE_TSC_EXCEED_SQL_LIMIT;
|
||||||
tscQueueAsyncError(fp, param, terrno);
|
tscQueueAsyncError(fp, param, terrno);
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
nPrintTsc("%s", sqlstr);
|
nPrintTsc("%s", sqlstr);
|
||||||
|
@ -96,12 +100,15 @@ void taos_query_a(TAOS *taos, const char *sqlstr, __async_cb_func_t fp, void *pa
|
||||||
if (pSql == NULL) {
|
if (pSql == NULL) {
|
||||||
tscError("failed to malloc sqlObj");
|
tscError("failed to malloc sqlObj");
|
||||||
tscQueueAsyncError(fp, param, TSDB_CODE_TSC_OUT_OF_MEMORY);
|
tscQueueAsyncError(fp, param, TSDB_CODE_TSC_OUT_OF_MEMORY);
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
doAsyncQuery(pObj, pSql, fp, param, sqlstr, sqlLen);
|
doAsyncQuery(pObj, pSql, fp, param, sqlstr, sqlLen);
|
||||||
|
|
||||||
|
return pSql;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void tscAsyncFetchRowsProxy(void *param, TAOS_RES *tres, int numOfRows) {
|
static void tscAsyncFetchRowsProxy(void *param, TAOS_RES *tres, int numOfRows) {
|
||||||
if (tres == NULL) {
|
if (tres == NULL) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2013,6 +2013,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
|
||||||
if ((getColumnIndexByName(pCmd, &pParamElem->pNode->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS)) {
|
if ((getColumnIndexByName(pCmd, &pParamElem->pNode->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS)) {
|
||||||
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3);
|
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index.columnIndex == TSDB_TBNAME_COLUMN_INDEX) {
|
if (index.columnIndex == TSDB_TBNAME_COLUMN_INDEX) {
|
||||||
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg6);
|
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg6);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2802,7 +2802,7 @@ static void multiVnodeInsertFinalize(void* param, TAOS_RES* tres, int numOfRows)
|
||||||
numOfFailed += 1;
|
numOfFailed += 1;
|
||||||
|
|
||||||
// clean up tableMeta in cache
|
// clean up tableMeta in cache
|
||||||
tscFreeQueryInfo(&pSql->cmd);
|
tscFreeQueryInfo(&pSql->cmd, false);
|
||||||
SQueryInfo* pQueryInfo = tscGetQueryInfoDetailSafely(&pSql->cmd, 0);
|
SQueryInfo* pQueryInfo = tscGetQueryInfoDetailSafely(&pSql->cmd, 0);
|
||||||
STableMetaInfo* pMasterTableMetaInfo = tscGetTableMetaInfoFromCmd(&pParentObj->cmd, pSql->cmd.clauseIndex, 0);
|
STableMetaInfo* pMasterTableMetaInfo = tscGetTableMetaInfoFromCmd(&pParentObj->cmd, pSql->cmd.clauseIndex, 0);
|
||||||
tscAddTableMetaInfo(pQueryInfo, &pMasterTableMetaInfo->name, NULL, NULL, NULL, NULL);
|
tscAddTableMetaInfo(pQueryInfo, &pMasterTableMetaInfo->name, NULL, NULL, NULL, NULL);
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "ttokendef.h"
|
#include "ttokendef.h"
|
||||||
|
|
||||||
static void freeQueryInfoImpl(SQueryInfo* pQueryInfo);
|
static void freeQueryInfoImpl(SQueryInfo* pQueryInfo);
|
||||||
static void clearAllTableMetaInfo(SQueryInfo* pQueryInfo);
|
static void clearAllTableMetaInfo(SQueryInfo* pQueryInfo, bool removeMeta);
|
||||||
|
|
||||||
static void tscStrToLower(char *str, int32_t n) {
|
static void tscStrToLower(char *str, int32_t n) {
|
||||||
if (str == NULL || n <= 0) { return;}
|
if (str == NULL || n <= 0) { return;}
|
||||||
|
@ -367,7 +367,7 @@ static void tscDestroyResPointerInfo(SSqlRes* pRes) {
|
||||||
pRes->data = NULL; // pRes->data points to the buffer of pRsp, no need to free
|
pRes->data = NULL; // pRes->data points to the buffer of pRsp, no need to free
|
||||||
}
|
}
|
||||||
|
|
||||||
void tscFreeQueryInfo(SSqlCmd* pCmd) {
|
void tscFreeQueryInfo(SSqlCmd* pCmd, bool removeMeta) {
|
||||||
if (pCmd == NULL || pCmd->numOfClause == 0) {
|
if (pCmd == NULL || pCmd->numOfClause == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ void tscFreeQueryInfo(SSqlCmd* pCmd) {
|
||||||
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, i);
|
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, i);
|
||||||
|
|
||||||
freeQueryInfoImpl(pQueryInfo);
|
freeQueryInfoImpl(pQueryInfo);
|
||||||
clearAllTableMetaInfo(pQueryInfo);
|
clearAllTableMetaInfo(pQueryInfo, removeMeta);
|
||||||
tfree(pQueryInfo);
|
tfree(pQueryInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ void tscResetSqlCmd(SSqlCmd* pCmd, bool removeMeta) {
|
||||||
|
|
||||||
pCmd->pTableBlockHashList = tscDestroyBlockHashTable(pCmd->pTableBlockHashList, removeMeta);
|
pCmd->pTableBlockHashList = tscDestroyBlockHashTable(pCmd->pTableBlockHashList, removeMeta);
|
||||||
pCmd->pDataBlocks = tscDestroyBlockArrayList(pCmd->pDataBlocks);
|
pCmd->pDataBlocks = tscDestroyBlockArrayList(pCmd->pDataBlocks);
|
||||||
tscFreeQueryInfo(pCmd);
|
tscFreeQueryInfo(pCmd, removeMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tscFreeSqlResult(SSqlObj* pSql) {
|
void tscFreeSqlResult(SSqlObj* pSql) {
|
||||||
|
@ -1847,10 +1847,17 @@ SArray* tscVgroupTableInfoDup(SArray* pVgroupTables) {
|
||||||
return pa;
|
return pa;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearAllTableMetaInfo(SQueryInfo* pQueryInfo) {
|
void clearAllTableMetaInfo(SQueryInfo* pQueryInfo, bool removeMeta) {
|
||||||
for(int32_t i = 0; i < pQueryInfo->numOfTables; ++i) {
|
for(int32_t i = 0; i < pQueryInfo->numOfTables; ++i) {
|
||||||
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, i);
|
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, i);
|
||||||
|
|
||||||
|
if (removeMeta) {
|
||||||
|
char name[TSDB_TABLE_FNAME_LEN] = {0};
|
||||||
|
tNameExtractFullName(&pTableMetaInfo->name, name);
|
||||||
|
|
||||||
|
taosHashRemove(tscTableMetaInfo, name, strnlen(name, TSDB_TABLE_FNAME_LEN));
|
||||||
|
}
|
||||||
|
|
||||||
tscFreeVgroupTableInfo(pTableMetaInfo->pVgroupTables);
|
tscFreeVgroupTableInfo(pTableMetaInfo->pVgroupTables);
|
||||||
tscClearTableMetaInfo(pTableMetaInfo);
|
tscClearTableMetaInfo(pTableMetaInfo);
|
||||||
free(pTableMetaInfo);
|
free(pTableMetaInfo);
|
||||||
|
@ -2714,7 +2721,11 @@ STableMeta* createSuperTableMeta(STableMetaMsg* pChild) {
|
||||||
uint32_t tscGetTableMetaSize(STableMeta* pTableMeta) {
|
uint32_t tscGetTableMetaSize(STableMeta* pTableMeta) {
|
||||||
assert(pTableMeta != NULL);
|
assert(pTableMeta != NULL);
|
||||||
|
|
||||||
int32_t totalCols = pTableMeta->tableInfo.numOfColumns + pTableMeta->tableInfo.numOfTags;
|
int32_t totalCols = 0;
|
||||||
|
if (pTableMeta->tableInfo.numOfColumns >= 0 && pTableMeta->tableInfo.numOfTags >= 0) {
|
||||||
|
totalCols = pTableMeta->tableInfo.numOfColumns + pTableMeta->tableInfo.numOfTags;
|
||||||
|
}
|
||||||
|
|
||||||
return sizeof(STableMeta) + totalCols * sizeof(SSchema);
|
return sizeof(STableMeta) + totalCols * sizeof(SSchema);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -430,10 +430,10 @@ static void doInitGlobalConfig(void) {
|
||||||
// port
|
// port
|
||||||
cfg.option = "serverPort";
|
cfg.option = "serverPort";
|
||||||
cfg.ptr = &tsServerPort;
|
cfg.ptr = &tsServerPort;
|
||||||
cfg.valType = TAOS_CFG_VTYPE_INT16;
|
cfg.valType = TAOS_CFG_VTYPE_UINT16;
|
||||||
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW | TSDB_CFG_CTYPE_B_CLIENT;
|
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW | TSDB_CFG_CTYPE_B_CLIENT;
|
||||||
cfg.minValue = 1;
|
cfg.minValue = 1;
|
||||||
cfg.maxValue = 65535;
|
cfg.maxValue = 65056;
|
||||||
cfg.ptrLength = 0;
|
cfg.ptrLength = 0;
|
||||||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||||
taosInitConfigOption(cfg);
|
taosInitConfigOption(cfg);
|
||||||
|
|
|
@ -29,7 +29,7 @@ typedef struct {
|
||||||
static SCheckItem tsCheckItem[TSDB_CHECK_ITEM_MAX] = {{0}};
|
static SCheckItem tsCheckItem[TSDB_CHECK_ITEM_MAX] = {{0}};
|
||||||
int64_t tsMinFreeMemSizeForStart = 0;
|
int64_t tsMinFreeMemSizeForStart = 0;
|
||||||
|
|
||||||
static int32_t bindTcpPort(int16_t port) {
|
static int32_t bindTcpPort(uint16_t port) {
|
||||||
SOCKET serverSocket;
|
SOCKET serverSocket;
|
||||||
struct sockaddr_in server_addr;
|
struct sockaddr_in server_addr;
|
||||||
|
|
||||||
|
@ -85,9 +85,9 @@ static int32_t bindUdpPort(int16_t port) {
|
||||||
|
|
||||||
static int32_t dnodeCheckNetwork() {
|
static int32_t dnodeCheckNetwork() {
|
||||||
int32_t ret;
|
int32_t ret;
|
||||||
int16_t startPort = tsServerPort;
|
uint16_t startPort = tsServerPort;
|
||||||
|
|
||||||
for (int16_t port = startPort; port < startPort + 12; port++) {
|
for (uint16_t port = startPort; port < startPort + 12; port++) {
|
||||||
ret = bindTcpPort(port);
|
ret = bindTcpPort(port);
|
||||||
if (0 != ret) {
|
if (0 != ret) {
|
||||||
dError("failed to tcp bind port %d, quit", port);
|
dError("failed to tcp bind port %d, quit", port);
|
||||||
|
|
|
@ -286,7 +286,7 @@ do { \
|
||||||
#define TSDB_MAX_COMP_LEVEL 2
|
#define TSDB_MAX_COMP_LEVEL 2
|
||||||
#define TSDB_DEFAULT_COMP_LEVEL 2
|
#define TSDB_DEFAULT_COMP_LEVEL 2
|
||||||
|
|
||||||
#define TSDB_MIN_WAL_LEVEL 1
|
#define TSDB_MIN_WAL_LEVEL 0
|
||||||
#define TSDB_MAX_WAL_LEVEL 2
|
#define TSDB_MAX_WAL_LEVEL 2
|
||||||
#define TSDB_DEFAULT_WAL_LEVEL 1
|
#define TSDB_DEFAULT_WAL_LEVEL 1
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,15 @@
|
||||||
"user": "root",
|
"user": "root",
|
||||||
"password": "taosdata",
|
"password": "taosdata",
|
||||||
"thread_count": 4,
|
"thread_count": 4,
|
||||||
"thread_count_create_tbl": 1,
|
"thread_count_create_tbl": 4,
|
||||||
"result_file": "./insert_res.txt",
|
"result_file": "./insert_res.txt",
|
||||||
"confirm_parameter_prompt": "no",
|
"confirm_parameter_prompt": "no",
|
||||||
"databases": [{
|
"databases": [{
|
||||||
"dbinfo": {
|
"dbinfo": {
|
||||||
"name": "db",
|
"name": "dbx",
|
||||||
"drop": "no",
|
"drop": "yes",
|
||||||
"replica": 1,
|
"replica": 1,
|
||||||
"days": 2,
|
"days": 10,
|
||||||
"cache": 16,
|
"cache": 16,
|
||||||
"blocks": 8,
|
"blocks": 8,
|
||||||
"precision": "ms",
|
"precision": "ms",
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
"maxRows": 4096,
|
"maxRows": 4096,
|
||||||
"comp":2,
|
"comp":2,
|
||||||
"walLevel":1,
|
"walLevel":1,
|
||||||
|
"cachelast":0,
|
||||||
"quorum":1,
|
"quorum":1,
|
||||||
"fsync":3000,
|
"fsync":3000,
|
||||||
"update": 0
|
"update": 0
|
||||||
|
@ -30,20 +31,20 @@
|
||||||
"super_tables": [{
|
"super_tables": [{
|
||||||
"name": "stb",
|
"name": "stb",
|
||||||
"child_table_exists":"no",
|
"child_table_exists":"no",
|
||||||
"childtable_count": 1,
|
"childtable_count": 100,
|
||||||
"childtable_prefix": "stb_",
|
"childtable_prefix": "stb_",
|
||||||
"auto_create_table": "no",
|
"auto_create_table": "no",
|
||||||
"data_source": "rand",
|
"data_source": "rand",
|
||||||
"insert_mode": "taosc",
|
"insert_mode": "taosc",
|
||||||
"insert_rate": 0,
|
"insert_rate": 0,
|
||||||
"insert_rows": 100000,
|
"insert_rows": 1000,
|
||||||
"multi_thread_write_one_tbl": "no",
|
"multi_thread_write_one_tbl": "no",
|
||||||
"number_of_tbl_in_one_sql": 1,
|
"number_of_tbl_in_one_sql": 0,
|
||||||
"rows_per_tbl": 100,
|
"rows_per_tbl": 100,
|
||||||
"max_sql_len": 1024000,
|
"max_sql_len": 1024000,
|
||||||
"disorder_ratio": 0,
|
"disorder_ratio": 0,
|
||||||
"disorder_range": 1000,
|
"disorder_range": 1000,
|
||||||
"timestamp_step": 10,
|
"timestamp_step": 1,
|
||||||
"start_timestamp": "2020-10-01 00:00:00.000",
|
"start_timestamp": "2020-10-01 00:00:00.000",
|
||||||
"sample_format": "csv",
|
"sample_format": "csv",
|
||||||
"sample_file": "./sample.csv",
|
"sample_file": "./sample.csv",
|
||||||
|
|
|
@ -6,13 +6,14 @@
|
||||||
"user": "root",
|
"user": "root",
|
||||||
"password": "taosdata",
|
"password": "taosdata",
|
||||||
"confirm_parameter_prompt": "yes",
|
"confirm_parameter_prompt": "yes",
|
||||||
"databases": "db01",
|
"databases": "dbx",
|
||||||
"specified_table_query":
|
"specified_table_query":
|
||||||
{"query_interval":1, "concurrent":1,
|
{"query_interval":1, "concurrent":4,
|
||||||
"sqls": [{"sql": "select count(*) from stb01", "result": "./query_res0.txt"}]
|
"sqls": [{"sql": "select last_row(*) from stb where color='red'", "result": "./query_res0.txt"},
|
||||||
|
{"sql": "select count(*) from stb_01", "result": "./query_res1.txt"}]
|
||||||
},
|
},
|
||||||
"super_table_query":
|
"super_table_query":
|
||||||
{"stblname": "stb01", "query_interval":1, "threads":1,
|
{"stblname": "stb", "query_interval":1, "threads":4,
|
||||||
"sqls": [{"sql": "select count(*) from xxxx", "result": "./query_res1.txt"}]
|
"sqls": [{"sql": "select last_row(*) from xxxx", "result": "./query_res2.txt"}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"port": 6030,
|
"port": 6030,
|
||||||
"user": "root",
|
"user": "root",
|
||||||
"password": "taosdata",
|
"password": "taosdata",
|
||||||
"databases": "db",
|
"databases": "dbx",
|
||||||
"specified_table_query":
|
"specified_table_query":
|
||||||
{"concurrent":1, "mode":"sync", "interval":5000, "restart":"yes", "keepProgress":"yes",
|
{"concurrent":1, "mode":"sync", "interval":5000, "restart":"yes", "keepProgress":"yes",
|
||||||
"sqls": [{"sql": "select avg(col1) from stb01 where col1 > 1;", "result": "./subscribe_res0.txt"}]
|
"sqls": [{"sql": "select avg(col1) from stb01 where col1 > 1;", "result": "./subscribe_res0.txt"}]
|
||||||
|
|
|
@ -257,14 +257,14 @@ typedef struct SColumn_S {
|
||||||
} StrColumn;
|
} StrColumn;
|
||||||
|
|
||||||
typedef struct SSuperTable_S {
|
typedef struct SSuperTable_S {
|
||||||
char sTblName[MAX_TB_NAME_SIZE];
|
char sTblName[MAX_TB_NAME_SIZE+1];
|
||||||
int childTblCount;
|
int childTblCount;
|
||||||
bool superTblExists; // 0: no, 1: yes
|
bool superTblExists; // 0: no, 1: yes
|
||||||
bool childTblExists; // 0: no, 1: yes
|
bool childTblExists; // 0: no, 1: yes
|
||||||
int batchCreateTableNum; // 0: no batch, > 0: batch table number in one sql
|
int batchCreateTableNum; // 0: no batch, > 0: batch table number in one sql
|
||||||
int8_t autoCreateTable; // 0: create sub table, 1: auto create sub table
|
int8_t autoCreateTable; // 0: create sub table, 1: auto create sub table
|
||||||
char childTblPrefix[MAX_TB_NAME_SIZE];
|
char childTblPrefix[MAX_TB_NAME_SIZE];
|
||||||
char dataSource[MAX_TB_NAME_SIZE]; // rand_gen or sample
|
char dataSource[MAX_TB_NAME_SIZE+1]; // rand_gen or sample
|
||||||
char insertMode[MAX_TB_NAME_SIZE]; // taosc, restful
|
char insertMode[MAX_TB_NAME_SIZE]; // taosc, restful
|
||||||
int insertRate; // 0: unlimit > 0 rows/s
|
int insertRate; // 0: unlimit > 0 rows/s
|
||||||
|
|
||||||
|
@ -279,8 +279,8 @@ typedef struct SSuperTable_S {
|
||||||
int timeStampStep;
|
int timeStampStep;
|
||||||
char startTimestamp[MAX_TB_NAME_SIZE]; //
|
char startTimestamp[MAX_TB_NAME_SIZE]; //
|
||||||
char sampleFormat[MAX_TB_NAME_SIZE]; // csv, json
|
char sampleFormat[MAX_TB_NAME_SIZE]; // csv, json
|
||||||
char sampleFile[MAX_FILE_NAME_LEN];
|
char sampleFile[MAX_FILE_NAME_LEN+1];
|
||||||
char tagsFile[MAX_FILE_NAME_LEN];
|
char tagsFile[MAX_FILE_NAME_LEN+1];
|
||||||
|
|
||||||
int columnCount;
|
int columnCount;
|
||||||
StrColumn columns[MAX_COLUMN_COUNT];
|
StrColumn columns[MAX_COLUMN_COUNT];
|
||||||
|
@ -335,6 +335,7 @@ typedef struct SDbCfg_S {
|
||||||
int maxRows;
|
int maxRows;
|
||||||
int comp;
|
int comp;
|
||||||
int walLevel;
|
int walLevel;
|
||||||
|
int cacheLast;
|
||||||
int fsync;
|
int fsync;
|
||||||
int replica;
|
int replica;
|
||||||
int update;
|
int update;
|
||||||
|
@ -355,12 +356,12 @@ typedef struct SDataBase_S {
|
||||||
} SDataBase;
|
} SDataBase;
|
||||||
|
|
||||||
typedef struct SDbs_S {
|
typedef struct SDbs_S {
|
||||||
char cfgDir[MAX_FILE_NAME_LEN];
|
char cfgDir[MAX_FILE_NAME_LEN+1];
|
||||||
char host[MAX_DB_NAME_SIZE];
|
char host[MAX_DB_NAME_SIZE];
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
char user[MAX_DB_NAME_SIZE];
|
char user[MAX_DB_NAME_SIZE];
|
||||||
char password[MAX_DB_NAME_SIZE];
|
char password[MAX_DB_NAME_SIZE];
|
||||||
char resultFile[MAX_FILE_NAME_LEN];
|
char resultFile[MAX_FILE_NAME_LEN+1];
|
||||||
bool use_metric;
|
bool use_metric;
|
||||||
bool insert_only;
|
bool insert_only;
|
||||||
bool do_aggreFunc;
|
bool do_aggreFunc;
|
||||||
|
@ -385,13 +386,13 @@ typedef struct SuperQueryInfo_S {
|
||||||
int subscribeInterval; // ms
|
int subscribeInterval; // ms
|
||||||
int subscribeRestart;
|
int subscribeRestart;
|
||||||
int subscribeKeepProgress;
|
int subscribeKeepProgress;
|
||||||
char sql[MAX_QUERY_SQL_COUNT][MAX_QUERY_SQL_LENGTH];
|
char sql[MAX_QUERY_SQL_COUNT][MAX_QUERY_SQL_LENGTH+1];
|
||||||
char result[MAX_QUERY_SQL_COUNT][MAX_FILE_NAME_LEN];
|
char result[MAX_QUERY_SQL_COUNT][MAX_FILE_NAME_LEN+1];
|
||||||
TAOS_SUB* tsub[MAX_QUERY_SQL_COUNT];
|
TAOS_SUB* tsub[MAX_QUERY_SQL_COUNT];
|
||||||
} SuperQueryInfo;
|
} SuperQueryInfo;
|
||||||
|
|
||||||
typedef struct SubQueryInfo_S {
|
typedef struct SubQueryInfo_S {
|
||||||
char sTblName[MAX_TB_NAME_SIZE];
|
char sTblName[MAX_TB_NAME_SIZE+1];
|
||||||
int rate; // 0: unlimit > 0 loop/s
|
int rate; // 0: unlimit > 0 loop/s
|
||||||
int threadCnt;
|
int threadCnt;
|
||||||
int subscribeMode; // 0: sync, 1: async
|
int subscribeMode; // 0: sync, 1: async
|
||||||
|
@ -401,20 +402,20 @@ typedef struct SubQueryInfo_S {
|
||||||
int childTblCount;
|
int childTblCount;
|
||||||
char childTblPrefix[MAX_TB_NAME_SIZE];
|
char childTblPrefix[MAX_TB_NAME_SIZE];
|
||||||
int sqlCount;
|
int sqlCount;
|
||||||
char sql[MAX_QUERY_SQL_COUNT][MAX_QUERY_SQL_LENGTH];
|
char sql[MAX_QUERY_SQL_COUNT][MAX_QUERY_SQL_LENGTH+1];
|
||||||
char result[MAX_QUERY_SQL_COUNT][MAX_FILE_NAME_LEN];
|
char result[MAX_QUERY_SQL_COUNT][MAX_FILE_NAME_LEN+1];
|
||||||
TAOS_SUB* tsub[MAX_QUERY_SQL_COUNT];
|
TAOS_SUB* tsub[MAX_QUERY_SQL_COUNT];
|
||||||
|
|
||||||
char* childTblName;
|
char* childTblName;
|
||||||
} SubQueryInfo;
|
} SubQueryInfo;
|
||||||
|
|
||||||
typedef struct SQueryMetaInfo_S {
|
typedef struct SQueryMetaInfo_S {
|
||||||
char cfgDir[MAX_FILE_NAME_LEN];
|
char cfgDir[MAX_FILE_NAME_LEN+1];
|
||||||
char host[MAX_DB_NAME_SIZE];
|
char host[MAX_DB_NAME_SIZE];
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
char user[MAX_DB_NAME_SIZE];
|
char user[MAX_DB_NAME_SIZE];
|
||||||
char password[MAX_DB_NAME_SIZE];
|
char password[MAX_DB_NAME_SIZE];
|
||||||
char dbName[MAX_DB_NAME_SIZE];
|
char dbName[MAX_DB_NAME_SIZE+1];
|
||||||
char queryMode[MAX_TB_NAME_SIZE]; // taosc, restful
|
char queryMode[MAX_TB_NAME_SIZE]; // taosc, restful
|
||||||
|
|
||||||
SuperQueryInfo superQueryInfo;
|
SuperQueryInfo superQueryInfo;
|
||||||
|
@ -424,7 +425,7 @@ typedef struct SQueryMetaInfo_S {
|
||||||
typedef struct SThreadInfo_S {
|
typedef struct SThreadInfo_S {
|
||||||
TAOS *taos;
|
TAOS *taos;
|
||||||
int threadID;
|
int threadID;
|
||||||
char db_name[MAX_DB_NAME_SIZE];
|
char db_name[MAX_DB_NAME_SIZE+1];
|
||||||
char fp[4096];
|
char fp[4096];
|
||||||
char tb_prefix[MAX_TB_NAME_SIZE];
|
char tb_prefix[MAX_TB_NAME_SIZE];
|
||||||
int start_table_id;
|
int start_table_id;
|
||||||
|
@ -1766,7 +1767,7 @@ static int getAllChildNameOfSuperTable(TAOS * taos, char* dbName, char* sTblName
|
||||||
char* pTblName = childTblName;
|
char* pTblName = childTblName;
|
||||||
while ((row = taos_fetch_row(res)) != NULL) {
|
while ((row = taos_fetch_row(res)) != NULL) {
|
||||||
int32_t* len = taos_fetch_lengths(res);
|
int32_t* len = taos_fetch_lengths(res);
|
||||||
tstrncpy(pTblName, (char *)row[0], len[0]);
|
tstrncpy(pTblName, (char *)row[0], len[0]+1);
|
||||||
//printf("==== sub table name: %s\n", pTblName);
|
//printf("==== sub table name: %s\n", pTblName);
|
||||||
count++;
|
count++;
|
||||||
if (count >= childTblCount - 1) {
|
if (count >= childTblCount - 1) {
|
||||||
|
@ -2022,6 +2023,9 @@ static int createDatabases() {
|
||||||
if (g_Dbs.db[i].dbCfg.walLevel > 0) {
|
if (g_Dbs.db[i].dbCfg.walLevel > 0) {
|
||||||
dataLen += snprintf(command + dataLen, BUFFER_SIZE - dataLen, "wal %d ", g_Dbs.db[i].dbCfg.walLevel);
|
dataLen += snprintf(command + dataLen, BUFFER_SIZE - dataLen, "wal %d ", g_Dbs.db[i].dbCfg.walLevel);
|
||||||
}
|
}
|
||||||
|
if (g_Dbs.db[i].dbCfg.cacheLast > 0) {
|
||||||
|
dataLen += snprintf(command + dataLen, BUFFER_SIZE - dataLen, "cachelast %d ", g_Dbs.db[i].dbCfg.cacheLast);
|
||||||
|
}
|
||||||
if (g_Dbs.db[i].dbCfg.fsync > 0) {
|
if (g_Dbs.db[i].dbCfg.fsync > 0) {
|
||||||
dataLen += snprintf(command + dataLen, BUFFER_SIZE - dataLen, "fsync %d ", g_Dbs.db[i].dbCfg.fsync);
|
dataLen += snprintf(command + dataLen, BUFFER_SIZE - dataLen, "fsync %d ", g_Dbs.db[i].dbCfg.fsync);
|
||||||
}
|
}
|
||||||
|
@ -2722,6 +2726,16 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cJSON* cacheLast= cJSON_GetObjectItem(dbinfo, "cachelast");
|
||||||
|
if (cacheLast && cacheLast->type == cJSON_Number) {
|
||||||
|
g_Dbs.db[i].dbCfg.cacheLast = cacheLast->valueint;
|
||||||
|
} else if (!cacheLast) {
|
||||||
|
g_Dbs.db[i].dbCfg.cacheLast = -1;
|
||||||
|
} else {
|
||||||
|
printf("failed to read json, cacheLast not found");
|
||||||
|
goto PARSE_OVER;
|
||||||
|
}
|
||||||
|
|
||||||
cJSON* quorum= cJSON_GetObjectItem(dbinfo, "quorum");
|
cJSON* quorum= cJSON_GetObjectItem(dbinfo, "quorum");
|
||||||
if (quorum && quorum->type == cJSON_Number) {
|
if (quorum && quorum->type == cJSON_Number) {
|
||||||
g_Dbs.db[i].dbCfg.quorum = quorum->valueint;
|
g_Dbs.db[i].dbCfg.quorum = quorum->valueint;
|
||||||
|
@ -2795,7 +2809,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
if (batchCreateTbl && batchCreateTbl->type == cJSON_Number) {
|
if (batchCreateTbl && batchCreateTbl->type == cJSON_Number) {
|
||||||
g_Dbs.db[i].superTbls[j].batchCreateTableNum = batchCreateTbl->valueint;
|
g_Dbs.db[i].superTbls[j].batchCreateTableNum = batchCreateTbl->valueint;
|
||||||
} else if (!batchCreateTbl) {
|
} else if (!batchCreateTbl) {
|
||||||
g_Dbs.db[i].superTbls[j].batchCreateTableNum = 2000;
|
g_Dbs.db[i].superTbls[j].batchCreateTableNum = 1000;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, batch_create_tbl_num not found");
|
printf("failed to read json, batch_create_tbl_num not found");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
|
@ -4475,7 +4489,7 @@ void replaceSubTblName(char* inSql, char* outSql, int tblIndex) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tstrncpy(outSql, inSql, pos - inSql);
|
tstrncpy(outSql, inSql, pos - inSql + 1);
|
||||||
//printf("1: %s\n", outSql);
|
//printf("1: %s\n", outSql);
|
||||||
strcat(outSql, subTblName);
|
strcat(outSql, subTblName);
|
||||||
//printf("2: %s\n", outSql);
|
//printf("2: %s\n", outSql);
|
||||||
|
@ -4496,12 +4510,12 @@ void *subQueryProcess(void *sarg) {
|
||||||
|
|
||||||
st = taosGetTimestampMs();
|
st = taosGetTimestampMs();
|
||||||
for (int i = winfo->start_table_id; i <= winfo->end_table_id; i++) {
|
for (int i = winfo->start_table_id; i <= winfo->end_table_id; i++) {
|
||||||
for (int i = 0; i < g_queryInfo.subQueryInfo.sqlCount; i++) {
|
for (int j = 0; j < g_queryInfo.subQueryInfo.sqlCount; j++) {
|
||||||
memset(sqlstr,0,sizeof(sqlstr));
|
memset(sqlstr,0,sizeof(sqlstr));
|
||||||
replaceSubTblName(g_queryInfo.subQueryInfo.sql[i], sqlstr, i);
|
replaceSubTblName(g_queryInfo.subQueryInfo.sql[j], sqlstr, i);
|
||||||
char tmpFile[MAX_FILE_NAME_LEN*2] = {0};
|
char tmpFile[MAX_FILE_NAME_LEN*2] = {0};
|
||||||
if (g_queryInfo.subQueryInfo.result[i][0] != 0) {
|
if (g_queryInfo.subQueryInfo.result[j][0] != 0) {
|
||||||
sprintf(tmpFile, "%s-%d", g_queryInfo.subQueryInfo.result[i], winfo->threadID);
|
sprintf(tmpFile, "%s-%d", g_queryInfo.subQueryInfo.result[j], winfo->threadID);
|
||||||
}
|
}
|
||||||
selectAndGetResult(winfo->taos, sqlstr, tmpFile);
|
selectAndGetResult(winfo->taos, sqlstr, tmpFile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -916,11 +916,13 @@ static int32_t mnodeProcessDropTableMsg(SMnodeMsg *pMsg) {
|
||||||
return TSDB_CODE_MND_DB_IN_DROPPING;
|
return TSDB_CODE_MND_DB_IN_DROPPING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (mnodeCheckIsMonitorDB(pMsg->pDb->name, tsMonitorDbName)) {
|
if (mnodeCheckIsMonitorDB(pMsg->pDb->name, tsMonitorDbName)) {
|
||||||
mError("msg:%p, app:%p table:%s, failed to drop table, in monitor database", pMsg, pMsg->rpcMsg.ahandle,
|
mError("msg:%p, app:%p table:%s, failed to drop table, in monitor database", pMsg, pMsg->rpcMsg.ahandle,
|
||||||
pDrop->name);
|
pDrop->name);
|
||||||
return TSDB_CODE_MND_MONITOR_DB_FORBIDDEN;
|
return TSDB_CODE_MND_MONITOR_DB_FORBIDDEN;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pDrop->name);
|
if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pDrop->name);
|
||||||
if (pMsg->pTable == NULL) {
|
if (pMsg->pTable == NULL) {
|
||||||
|
@ -3020,10 +3022,12 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) {
|
||||||
return TSDB_CODE_MND_DB_IN_DROPPING;
|
return TSDB_CODE_MND_DB_IN_DROPPING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (mnodeCheckIsMonitorDB(pMsg->pDb->name, tsMonitorDbName)) {
|
if (mnodeCheckIsMonitorDB(pMsg->pDb->name, tsMonitorDbName)) {
|
||||||
mError("msg:%p, app:%p table:%s, failed to alter table, its log db", pMsg, pMsg->rpcMsg.ahandle, pAlter->tableFname);
|
mError("msg:%p, app:%p table:%s, failed to alter table, its log db", pMsg, pMsg->rpcMsg.ahandle, pAlter->tableFname);
|
||||||
return TSDB_CODE_MND_MONITOR_DB_FORBIDDEN;
|
return TSDB_CODE_MND_MONITOR_DB_FORBIDDEN;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pAlter->tableFname);
|
if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pAlter->tableFname);
|
||||||
if (pMsg->pTable == NULL) {
|
if (pMsg->pTable == NULL) {
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
#define REST_JSON_DATA_LEN 4
|
#define REST_JSON_DATA_LEN 4
|
||||||
#define REST_JSON_HEAD "head"
|
#define REST_JSON_HEAD "head"
|
||||||
#define REST_JSON_HEAD_LEN 4
|
#define REST_JSON_HEAD_LEN 4
|
||||||
|
#define REST_JSON_HEAD_INFO "column_meta"
|
||||||
|
#define REST_JSON_HEAD_INFO_LEN 11
|
||||||
#define REST_JSON_ROWS "rows"
|
#define REST_JSON_ROWS "rows"
|
||||||
#define REST_JSON_ROWS_LEN 4
|
#define REST_JSON_ROWS_LEN 4
|
||||||
#define REST_JSON_AFFECT_ROWS "affected_rows"
|
#define REST_JSON_AFFECT_ROWS "affected_rows"
|
||||||
|
|
|
@ -59,7 +59,9 @@ void httpDispatchToResultQueue(void *param, TAOS_RES *result, int32_t code, int3
|
||||||
pMsg->fp = fp;
|
pMsg->fp = fp;
|
||||||
taosWriteQitem(tsHttpQueue, TAOS_QTYPE_RPC, pMsg);
|
taosWriteQitem(tsHttpQueue, TAOS_QTYPE_RPC, pMsg);
|
||||||
} else {
|
} else {
|
||||||
(*fp)(param, result, code, rows);
|
taos_stop_query(result);
|
||||||
|
taos_free_result(result);
|
||||||
|
//(*fp)(param, result, code, rows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,44 @@ void restStartSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result)
|
||||||
// head array end
|
// head array end
|
||||||
httpJsonToken(jsonBuf, JsonArrEnd);
|
httpJsonToken(jsonBuf, JsonArrEnd);
|
||||||
|
|
||||||
|
// column_meta begin
|
||||||
|
httpJsonItemToken(jsonBuf);
|
||||||
|
httpJsonPairHead(jsonBuf, REST_JSON_HEAD_INFO, REST_JSON_HEAD_INFO_LEN);
|
||||||
|
// column_meta array begin
|
||||||
|
httpJsonItemToken(jsonBuf);
|
||||||
|
httpJsonToken(jsonBuf, JsonArrStt);
|
||||||
|
|
||||||
|
if (num_fields == 0) {
|
||||||
|
httpJsonItemToken(jsonBuf);
|
||||||
|
httpJsonToken(jsonBuf, JsonArrStt);
|
||||||
|
|
||||||
|
httpJsonItemToken(jsonBuf);
|
||||||
|
httpJsonString(jsonBuf, REST_JSON_AFFECT_ROWS, REST_JSON_AFFECT_ROWS_LEN);
|
||||||
|
httpJsonItemToken(jsonBuf);
|
||||||
|
httpJsonInt(jsonBuf, TSDB_DATA_TYPE_INT);
|
||||||
|
httpJsonItemToken(jsonBuf);
|
||||||
|
httpJsonInt(jsonBuf, 4);
|
||||||
|
|
||||||
|
httpJsonToken(jsonBuf, JsonArrEnd);
|
||||||
|
} else {
|
||||||
|
for (int32_t i = 0; i < num_fields; ++i) {
|
||||||
|
httpJsonItemToken(jsonBuf);
|
||||||
|
httpJsonToken(jsonBuf, JsonArrStt);
|
||||||
|
|
||||||
|
httpJsonItemToken(jsonBuf);
|
||||||
|
httpJsonString(jsonBuf, fields[i].name, (int32_t)strlen(fields[i].name));
|
||||||
|
httpJsonItemToken(jsonBuf);
|
||||||
|
httpJsonInt(jsonBuf, fields[i].type);
|
||||||
|
httpJsonItemToken(jsonBuf);
|
||||||
|
httpJsonInt(jsonBuf, fields[i].bytes);
|
||||||
|
|
||||||
|
httpJsonToken(jsonBuf, JsonArrEnd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// column_meta array end
|
||||||
|
httpJsonToken(jsonBuf, JsonArrEnd);
|
||||||
|
|
||||||
// data begin
|
// data begin
|
||||||
httpJsonItemToken(jsonBuf);
|
httpJsonItemToken(jsonBuf);
|
||||||
httpJsonPairHead(jsonBuf, REST_JSON_DATA, REST_JSON_DATA_LEN);
|
httpJsonPairHead(jsonBuf, REST_JSON_DATA, REST_JSON_DATA_LEN);
|
||||||
|
|
|
@ -2733,15 +2733,19 @@ static void percentile_function(SQLFunctionCtx *pCtx) {
|
||||||
if (pInfo->stage == 0) {
|
if (pInfo->stage == 0) {
|
||||||
if (pCtx->preAggVals.isSet) {
|
if (pCtx->preAggVals.isSet) {
|
||||||
double tmin = 0.0, tmax = 0.0;
|
double tmin = 0.0, tmax = 0.0;
|
||||||
if (pCtx->inputType >= TSDB_DATA_TYPE_TINYINT && pCtx->inputType <= TSDB_DATA_TYPE_BIGINT) {
|
if (IS_SIGNED_NUMERIC_TYPE(pCtx->inputType)) {
|
||||||
tmin = (double)GET_INT64_VAL(&pCtx->preAggVals.statis.min);
|
tmin = (double)GET_INT64_VAL(&pCtx->preAggVals.statis.min);
|
||||||
tmax = (double)GET_INT64_VAL(&pCtx->preAggVals.statis.max);
|
tmax = (double)GET_INT64_VAL(&pCtx->preAggVals.statis.max);
|
||||||
} else if (pCtx->inputType == TSDB_DATA_TYPE_DOUBLE || pCtx->inputType == TSDB_DATA_TYPE_FLOAT) {
|
} else if (IS_FLOAT_TYPE(pCtx->inputType)) {
|
||||||
tmin = GET_DOUBLE_VAL(&pCtx->preAggVals.statis.min);
|
tmin = GET_DOUBLE_VAL(&pCtx->preAggVals.statis.min);
|
||||||
tmax = GET_DOUBLE_VAL(&pCtx->preAggVals.statis.max);
|
tmax = GET_DOUBLE_VAL(&pCtx->preAggVals.statis.max);
|
||||||
|
} else if (IS_UNSIGNED_NUMERIC_TYPE(pCtx->inputType)) {
|
||||||
|
tmin = (double)GET_UINT64_VAL(&pCtx->preAggVals.statis.min);
|
||||||
|
tmax = (double)GET_UINT64_VAL(&pCtx->preAggVals.statis.max);
|
||||||
} else {
|
} else {
|
||||||
assert(true);
|
assert(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GET_DOUBLE_VAL(&pInfo->minval) > tmin) {
|
if (GET_DOUBLE_VAL(&pInfo->minval) > tmin) {
|
||||||
SET_DOUBLE_VAL(&pInfo->minval, tmin);
|
SET_DOUBLE_VAL(&pInfo->minval, tmin);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ typedef struct {
|
||||||
TSKEY keyLast;
|
TSKEY keyLast;
|
||||||
int64_t numOfRows;
|
int64_t numOfRows;
|
||||||
SSkipList* pData;
|
SSkipList* pData;
|
||||||
|
T_REF_DECLARE()
|
||||||
} STableData;
|
} STableData;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -76,7 +77,7 @@ typedef struct {
|
||||||
|
|
||||||
int tsdbRefMemTable(STsdbRepo* pRepo, SMemTable* pMemTable);
|
int tsdbRefMemTable(STsdbRepo* pRepo, SMemTable* pMemTable);
|
||||||
int tsdbUnRefMemTable(STsdbRepo* pRepo, SMemTable* pMemTable);
|
int tsdbUnRefMemTable(STsdbRepo* pRepo, SMemTable* pMemTable);
|
||||||
int tsdbTakeMemSnapshot(STsdbRepo* pRepo, SMemTable** pMem, SMemTable** pIMem);
|
int tsdbTakeMemSnapshot(STsdbRepo* pRepo, SMemTable** pMem, SMemTable** pIMem, SArray* pATable);
|
||||||
void tsdbUnTakeMemSnapShot(STsdbRepo* pRepo, SMemTable* pMem, SMemTable* pIMem);
|
void tsdbUnTakeMemSnapShot(STsdbRepo* pRepo, SMemTable* pMem, SMemTable* pIMem);
|
||||||
void* tsdbAllocBytes(STsdbRepo* pRepo, int bytes);
|
void* tsdbAllocBytes(STsdbRepo* pRepo, int bytes);
|
||||||
int tsdbAsyncCommit(STsdbRepo* pRepo);
|
int tsdbAsyncCommit(STsdbRepo* pRepo);
|
||||||
|
|
|
@ -597,7 +597,7 @@ int tsdbRestoreInfo(STsdbRepo *pRepo) {
|
||||||
// Get the data in row
|
// Get the data in row
|
||||||
ASSERT(pTable->lastRow == NULL);
|
ASSERT(pTable->lastRow == NULL);
|
||||||
STSchema *pSchema = tsdbGetTableSchema(pTable);
|
STSchema *pSchema = tsdbGetTableSchema(pTable);
|
||||||
pTable->lastRow = taosTMalloc(schemaTLen(pSchema));
|
pTable->lastRow = taosTMalloc(dataRowMaxBytesFromSchema(pSchema));
|
||||||
if (pTable->lastRow == NULL) {
|
if (pTable->lastRow == NULL) {
|
||||||
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
|
||||||
tsdbDestroyReadH(&readh);
|
tsdbDestroyReadH(&readh);
|
||||||
|
|
|
@ -124,17 +124,66 @@ int tsdbUnRefMemTable(STsdbRepo *pRepo, SMemTable *pMemTable) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tsdbTakeMemSnapshot(STsdbRepo *pRepo, SMemTable **pMem, SMemTable **pIMem) {
|
int tsdbTakeMemSnapshot(STsdbRepo *pRepo, SMemTable **pMem, SMemTable **pIMem, SArray *pATable) {
|
||||||
|
SMemTable *tmem;
|
||||||
|
|
||||||
|
// Get snap object
|
||||||
if (tsdbLockRepo(pRepo) < 0) return -1;
|
if (tsdbLockRepo(pRepo) < 0) return -1;
|
||||||
|
|
||||||
*pMem = pRepo->mem;
|
tmem = pRepo->mem;
|
||||||
*pIMem = pRepo->imem;
|
*pIMem = pRepo->imem;
|
||||||
tsdbRefMemTable(pRepo, *pMem);
|
tsdbRefMemTable(pRepo, tmem);
|
||||||
tsdbRefMemTable(pRepo, *pIMem);
|
tsdbRefMemTable(pRepo, *pIMem);
|
||||||
|
|
||||||
if (tsdbUnlockRepo(pRepo) < 0) return -1;
|
if (tsdbUnlockRepo(pRepo) < 0) return -1;
|
||||||
|
|
||||||
if (*pMem != NULL) taosRLockLatch(&((*pMem)->latch));
|
// Copy mem objects and ref needed STableData
|
||||||
|
if (tmem) {
|
||||||
|
taosRLockLatch(&(tmem->latch));
|
||||||
|
|
||||||
|
*pMem = (SMemTable *)calloc(1, sizeof(**pMem));
|
||||||
|
if (*pMem == NULL) {
|
||||||
|
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
|
||||||
|
taosRUnLockLatch(&(tmem->latch));
|
||||||
|
tsdbUnRefMemTable(pRepo, tmem);
|
||||||
|
tsdbUnRefMemTable(pRepo, *pIMem);
|
||||||
|
*pMem = NULL;
|
||||||
|
*pIMem = NULL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
(*pMem)->tData = (STableData **)calloc(tmem->maxTables, sizeof(STableData *));
|
||||||
|
if ((*pMem)->tData == NULL) {
|
||||||
|
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
|
||||||
|
taosRUnLockLatch(&(tmem->latch));
|
||||||
|
free(*pMem);
|
||||||
|
tsdbUnRefMemTable(pRepo, tmem);
|
||||||
|
tsdbUnRefMemTable(pRepo, *pIMem);
|
||||||
|
*pMem = NULL;
|
||||||
|
*pIMem = NULL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
(*pMem)->keyFirst = tmem->keyFirst;
|
||||||
|
(*pMem)->keyLast = tmem->keyLast;
|
||||||
|
(*pMem)->numOfRows = tmem->numOfRows;
|
||||||
|
(*pMem)->maxTables = tmem->maxTables;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < taosArrayGetSize(pATable); i++) {
|
||||||
|
STable * pTable = *(STable **)taosArrayGet(pATable, i);
|
||||||
|
int32_t tid = TABLE_TID(pTable);
|
||||||
|
STableData *pTableData = (tid < tmem->maxTables) ? tmem->tData[tid] : NULL;
|
||||||
|
|
||||||
|
if ((pTableData == NULL) || (TABLE_UID(pTable) != pTableData->uid)) continue;
|
||||||
|
|
||||||
|
(*pMem)->tData[tid] = tmem->tData[tid];
|
||||||
|
T_REF_INC(tmem->tData[tid]);
|
||||||
|
}
|
||||||
|
|
||||||
|
taosRUnLockLatch(&(tmem->latch));
|
||||||
|
}
|
||||||
|
|
||||||
|
tsdbUnRefMemTable(pRepo, tmem);
|
||||||
|
|
||||||
tsdbDebug("vgId:%d take memory snapshot, pMem %p pIMem %p", REPO_ID(pRepo), *pMem, *pIMem);
|
tsdbDebug("vgId:%d take memory snapshot, pMem %p pIMem %p", REPO_ID(pRepo), *pMem, *pIMem);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -144,8 +193,14 @@ void tsdbUnTakeMemSnapShot(STsdbRepo *pRepo, SMemTable *pMem, SMemTable *pIMem)
|
||||||
tsdbDebug("vgId:%d untake memory snapshot, pMem %p pIMem %p", REPO_ID(pRepo), pMem, pIMem);
|
tsdbDebug("vgId:%d untake memory snapshot, pMem %p pIMem %p", REPO_ID(pRepo), pMem, pIMem);
|
||||||
|
|
||||||
if (pMem != NULL) {
|
if (pMem != NULL) {
|
||||||
taosRUnLockLatch(&(pMem->latch));
|
for (size_t i = 0; i < pMem->maxTables; i++) {
|
||||||
tsdbUnRefMemTable(pRepo, pMem);
|
STableData *pTableData = pMem->tData[i];
|
||||||
|
if (pTableData) {
|
||||||
|
tsdbFreeTableData(pTableData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(pMem->tData);
|
||||||
|
free(pMem);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pIMem != NULL) {
|
if (pIMem != NULL) {
|
||||||
|
@ -436,7 +491,7 @@ static STableData *tsdbNewTableData(STsdbCfg *pCfg, STable *pTable) {
|
||||||
STableData *pTableData = (STableData *)calloc(1, sizeof(*pTableData));
|
STableData *pTableData = (STableData *)calloc(1, sizeof(*pTableData));
|
||||||
if (pTableData == NULL) {
|
if (pTableData == NULL) {
|
||||||
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
|
||||||
goto _err;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pTableData->uid = TABLE_UID(pTable);
|
pTableData->uid = TABLE_UID(pTable);
|
||||||
|
@ -449,21 +504,23 @@ static STableData *tsdbNewTableData(STsdbCfg *pCfg, STable *pTable) {
|
||||||
tkeyComparFn, pCfg->update ? SL_UPDATE_DUP_KEY : SL_DISCARD_DUP_KEY, tsdbGetTsTupleKey);
|
tkeyComparFn, pCfg->update ? SL_UPDATE_DUP_KEY : SL_DISCARD_DUP_KEY, tsdbGetTsTupleKey);
|
||||||
if (pTableData->pData == NULL) {
|
if (pTableData->pData == NULL) {
|
||||||
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
|
||||||
goto _err;
|
free(pTableData);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pTableData;
|
T_REF_INC(pTableData);
|
||||||
|
|
||||||
_err:
|
return pTableData;
|
||||||
tsdbFreeTableData(pTableData);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tsdbFreeTableData(STableData *pTableData) {
|
static void tsdbFreeTableData(STableData *pTableData) {
|
||||||
if (pTableData) {
|
if (pTableData) {
|
||||||
|
int32_t ref = T_REF_DEC(pTableData);
|
||||||
|
if (ref == 0) {
|
||||||
tSkipListDestroy(pTableData->pData);
|
tSkipListDestroy(pTableData->pData);
|
||||||
free(pTableData);
|
free(pTableData);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *tsdbGetTsTupleKey(const void *data) { return dataRowTuple((SDataRow)data); }
|
static char *tsdbGetTsTupleKey(const void *data) { return dataRowTuple((SDataRow)data); }
|
||||||
|
|
|
@ -187,13 +187,15 @@ static SArray* getDefaultLoadColumns(STsdbQueryHandle* pQueryHandle, bool loadTS
|
||||||
return pLocalIdList;
|
return pLocalIdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tsdbMayTakeMemSnapshot(STsdbQueryHandle* pQueryHandle) {
|
static void tsdbMayTakeMemSnapshot(STsdbQueryHandle* pQueryHandle, SArray* psTable) {
|
||||||
assert(pQueryHandle != NULL && pQueryHandle->pMemRef != NULL);
|
assert(pQueryHandle != NULL && pQueryHandle->pMemRef != NULL);
|
||||||
|
|
||||||
SMemRef* pMemRef = pQueryHandle->pMemRef;
|
SMemRef* pMemRef = pQueryHandle->pMemRef;
|
||||||
if (pQueryHandle->pMemRef->ref++ == 0) {
|
if (pQueryHandle->pMemRef->ref++ == 0) {
|
||||||
tsdbTakeMemSnapshot(pQueryHandle->pTsdb, (SMemTable**)&(pMemRef->mem), (SMemTable**)&(pMemRef->imem));
|
tsdbTakeMemSnapshot(pQueryHandle->pTsdb, (SMemTable**)&(pMemRef->mem), (SMemTable**)&(pMemRef->imem), psTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taosArrayDestroy(psTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tsdbMayUnTakeMemSnapshot(STsdbQueryHandle* pQueryHandle) {
|
static void tsdbMayUnTakeMemSnapshot(STsdbQueryHandle* pQueryHandle) {
|
||||||
|
@ -242,7 +244,7 @@ int64_t tsdbGetNumOfRowsInMemTable(TsdbQueryHandleT* pHandle) {
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SArray* createCheckInfoFromTableGroup(STsdbQueryHandle* pQueryHandle, STableGroupInfo* pGroupList, STsdbMeta* pMeta) {
|
static SArray* createCheckInfoFromTableGroup(STsdbQueryHandle* pQueryHandle, STableGroupInfo* pGroupList, STsdbMeta* pMeta, SArray** psTable) {
|
||||||
size_t sizeOfGroup = taosArrayGetSize(pGroupList->pGroupList);
|
size_t sizeOfGroup = taosArrayGetSize(pGroupList->pGroupList);
|
||||||
assert(sizeOfGroup >= 1 && pMeta != NULL);
|
assert(sizeOfGroup >= 1 && pMeta != NULL);
|
||||||
|
|
||||||
|
@ -252,6 +254,12 @@ static SArray* createCheckInfoFromTableGroup(STsdbQueryHandle* pQueryHandle, STa
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SArray* pTable = taosArrayInit(4, sizeof(STable*));
|
||||||
|
if (pTable == NULL) {
|
||||||
|
taosArrayDestroy(pTableCheckInfo);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// todo apply the lastkey of table check to avoid to load header file
|
// todo apply the lastkey of table check to avoid to load header file
|
||||||
for (int32_t i = 0; i < sizeOfGroup; ++i) {
|
for (int32_t i = 0; i < sizeOfGroup; ++i) {
|
||||||
SArray* group = *(SArray**) taosArrayGet(pGroupList->pGroupList, i);
|
SArray* group = *(SArray**) taosArrayGet(pGroupList->pGroupList, i);
|
||||||
|
@ -284,24 +292,40 @@ static SArray* createCheckInfoFromTableGroup(STsdbQueryHandle* pQueryHandle, STa
|
||||||
}
|
}
|
||||||
|
|
||||||
taosArraySort(pTableCheckInfo, tsdbCheckInfoCompar);
|
taosArraySort(pTableCheckInfo, tsdbCheckInfoCompar);
|
||||||
|
|
||||||
|
size_t gsize = taosArrayGetSize(pTableCheckInfo);
|
||||||
|
|
||||||
|
for (int32_t i = 0; i < gsize; ++i) {
|
||||||
|
STableCheckInfo* pInfo = (STableCheckInfo*) taosArrayGet(pTableCheckInfo, i);
|
||||||
|
|
||||||
|
taosArrayPush(pTable, &pInfo->pTableObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
*psTable = pTable;
|
||||||
|
|
||||||
return pTableCheckInfo;
|
return pTableCheckInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SArray* createCheckInfoFromCheckInfo(SArray* pTableCheckInfo, TSKEY skey) {
|
static SArray* createCheckInfoFromCheckInfo(SArray* pTableCheckInfo, TSKEY skey, SArray** psTable) {
|
||||||
size_t si = taosArrayGetSize(pTableCheckInfo);
|
size_t si = taosArrayGetSize(pTableCheckInfo);
|
||||||
SArray* pNew = taosArrayInit(si, sizeof(STableCheckInfo));
|
SArray* pNew = taosArrayInit(si, sizeof(STableCheckInfo));
|
||||||
if (pNew == NULL) {
|
if (pNew == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SArray* pTable = taosArrayInit(si, sizeof(STable*));
|
||||||
|
|
||||||
for (int32_t j = 0; j < si; ++j) {
|
for (int32_t j = 0; j < si; ++j) {
|
||||||
STableCheckInfo* pCheckInfo = (STableCheckInfo*) taosArrayGet(pTableCheckInfo, j);
|
STableCheckInfo* pCheckInfo = (STableCheckInfo*) taosArrayGet(pTableCheckInfo, j);
|
||||||
STableCheckInfo info = { .lastKey = skey, .pTableObj = pCheckInfo->pTableObj};
|
STableCheckInfo info = { .lastKey = skey, .pTableObj = pCheckInfo->pTableObj};
|
||||||
|
|
||||||
info.tableId = pCheckInfo->tableId;
|
info.tableId = pCheckInfo->tableId;
|
||||||
taosArrayPush(pNew, &info);
|
taosArrayPush(pNew, &info);
|
||||||
|
taosArrayPush(pTable, &pCheckInfo->pTableObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*psTable = pTable;
|
||||||
|
|
||||||
// it is ordered already, no need to sort again.
|
// it is ordered already, no need to sort again.
|
||||||
taosArraySort(pNew, tsdbCheckInfoCompar);
|
taosArraySort(pNew, tsdbCheckInfoCompar);
|
||||||
return pNew;
|
return pNew;
|
||||||
|
@ -332,7 +356,7 @@ static STsdbQueryHandle* tsdbQueryTablesImpl(STsdbRepo* tsdb, STsdbQueryCond* pC
|
||||||
goto out_of_memory;
|
goto out_of_memory;
|
||||||
}
|
}
|
||||||
|
|
||||||
tsdbMayTakeMemSnapshot(pQueryHandle);
|
//tsdbMayTakeMemSnapshot(pQueryHandle);
|
||||||
assert(pCond != NULL && pCond->numOfCols > 0 && pMemRef != NULL);
|
assert(pCond != NULL && pCond->numOfCols > 0 && pMemRef != NULL);
|
||||||
|
|
||||||
if (ASCENDING_TRAVERSE(pCond->order)) {
|
if (ASCENDING_TRAVERSE(pCond->order)) {
|
||||||
|
@ -393,14 +417,18 @@ TsdbQueryHandleT* tsdbQueryTables(STsdbRepo* tsdb, STsdbQueryCond* pCond, STable
|
||||||
STsdbMeta* pMeta = tsdbGetMeta(tsdb);
|
STsdbMeta* pMeta = tsdbGetMeta(tsdb);
|
||||||
assert(pMeta != NULL);
|
assert(pMeta != NULL);
|
||||||
|
|
||||||
|
SArray* psTable = NULL;
|
||||||
|
|
||||||
// todo apply the lastkey of table check to avoid to load header file
|
// todo apply the lastkey of table check to avoid to load header file
|
||||||
pQueryHandle->pTableCheckInfo = createCheckInfoFromTableGroup(pQueryHandle, groupList, pMeta);
|
pQueryHandle->pTableCheckInfo = createCheckInfoFromTableGroup(pQueryHandle, groupList, pMeta, &psTable);
|
||||||
if (pQueryHandle->pTableCheckInfo == NULL) {
|
if (pQueryHandle->pTableCheckInfo == NULL) {
|
||||||
tsdbCleanupQueryHandle(pQueryHandle);
|
tsdbCleanupQueryHandle(pQueryHandle);
|
||||||
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tsdbMayTakeMemSnapshot(pQueryHandle, psTable);
|
||||||
|
|
||||||
tsdbDebug("%p total numOfTable:%" PRIzu " in query, %p", pQueryHandle, taosArrayGetSize(pQueryHandle->pTableCheckInfo), pQueryHandle->qinfo);
|
tsdbDebug("%p total numOfTable:%" PRIzu " in query, %p", pQueryHandle, taosArrayGetSize(pQueryHandle->pTableCheckInfo), pQueryHandle->qinfo);
|
||||||
return (TsdbQueryHandleT) pQueryHandle;
|
return (TsdbQueryHandleT) pQueryHandle;
|
||||||
}
|
}
|
||||||
|
@ -2337,12 +2365,18 @@ static int32_t doGetExternalRow(STsdbQueryHandle* pQueryHandle, int16_t type, SM
|
||||||
pSecQueryHandle = tsdbQueryTablesImpl(pQueryHandle->pTsdb, &cond, pQueryHandle->qinfo, pMemRef);
|
pSecQueryHandle = tsdbQueryTablesImpl(pQueryHandle->pTsdb, &cond, pQueryHandle->qinfo, pMemRef);
|
||||||
|
|
||||||
tfree(cond.colList);
|
tfree(cond.colList);
|
||||||
pSecQueryHandle->pTableCheckInfo = createCheckInfoFromCheckInfo(pQueryHandle->pTableCheckInfo, pSecQueryHandle->window.skey);
|
|
||||||
|
SArray* psTable = NULL;
|
||||||
|
|
||||||
|
pSecQueryHandle->pTableCheckInfo = createCheckInfoFromCheckInfo(pQueryHandle->pTableCheckInfo, pSecQueryHandle->window.skey, &psTable);
|
||||||
if (pSecQueryHandle->pTableCheckInfo == NULL) {
|
if (pSecQueryHandle->pTableCheckInfo == NULL) {
|
||||||
terrno = TSDB_CODE_QRY_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_QRY_OUT_OF_MEMORY;
|
||||||
goto out_of_memory;
|
goto out_of_memory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tsdbMayTakeMemSnapshot(pSecQueryHandle, psTable);
|
||||||
|
|
||||||
if (!tsdbNextDataBlock((void*)pSecQueryHandle)) {
|
if (!tsdbNextDataBlock((void*)pSecQueryHandle)) {
|
||||||
// no result in current query, free the corresponding result rows structure
|
// no result in current query, free the corresponding result rows structure
|
||||||
if (type == TSDB_PREV_ROW) {
|
if (type == TSDB_PREV_ROW) {
|
||||||
|
|
|
@ -44,6 +44,7 @@ enum {
|
||||||
TAOS_CFG_VTYPE_INT8,
|
TAOS_CFG_VTYPE_INT8,
|
||||||
TAOS_CFG_VTYPE_INT16,
|
TAOS_CFG_VTYPE_INT16,
|
||||||
TAOS_CFG_VTYPE_INT32,
|
TAOS_CFG_VTYPE_INT32,
|
||||||
|
TAOS_CFG_VTYPE_UINT16,
|
||||||
TAOS_CFG_VTYPE_FLOAT,
|
TAOS_CFG_VTYPE_FLOAT,
|
||||||
TAOS_CFG_VTYPE_STRING,
|
TAOS_CFG_VTYPE_STRING,
|
||||||
TAOS_CFG_VTYPE_IPSTR,
|
TAOS_CFG_VTYPE_IPSTR,
|
||||||
|
|
|
@ -95,6 +95,23 @@ static void taosReadInt16Config(SGlobalCfg *cfg, char *input_value) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void taosReadUInt16Config(SGlobalCfg *cfg, char *input_value) {
|
||||||
|
int32_t value = atoi(input_value);
|
||||||
|
uint16_t *option = (uint16_t *)cfg->ptr;
|
||||||
|
if (value < cfg->minValue || value > cfg->maxValue) {
|
||||||
|
uError("config option:%s, input value:%s, out of range[%f, %f], use default value:%d",
|
||||||
|
cfg->option, input_value, cfg->minValue, cfg->maxValue, *option);
|
||||||
|
} else {
|
||||||
|
if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
|
||||||
|
*option = (uint16_t)value;
|
||||||
|
cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
|
||||||
|
} else {
|
||||||
|
uWarn("config option:%s, input value:%s, is configured by %s, use %d", cfg->option, input_value,
|
||||||
|
tsCfgStatusStr[cfg->cfgStatus], *option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void taosReadInt8Config(SGlobalCfg *cfg, char *input_value) {
|
static void taosReadInt8Config(SGlobalCfg *cfg, char *input_value) {
|
||||||
int32_t value = atoi(input_value);
|
int32_t value = atoi(input_value);
|
||||||
int8_t *option = (int8_t *)cfg->ptr;
|
int8_t *option = (int8_t *)cfg->ptr;
|
||||||
|
@ -239,6 +256,9 @@ static void taosReadConfigOption(const char *option, char *value, char *value2,
|
||||||
case TAOS_CFG_VTYPE_INT32:
|
case TAOS_CFG_VTYPE_INT32:
|
||||||
taosReadInt32Config(cfg, value);
|
taosReadInt32Config(cfg, value);
|
||||||
break;
|
break;
|
||||||
|
case TAOS_CFG_VTYPE_UINT16:
|
||||||
|
taosReadUInt16Config(cfg, value);
|
||||||
|
break;
|
||||||
case TAOS_CFG_VTYPE_FLOAT:
|
case TAOS_CFG_VTYPE_FLOAT:
|
||||||
taosReadFloatConfig(cfg, value);
|
taosReadFloatConfig(cfg, value);
|
||||||
break;
|
break;
|
||||||
|
@ -422,6 +442,9 @@ void taosPrintGlobalCfg() {
|
||||||
case TAOS_CFG_VTYPE_INT32:
|
case TAOS_CFG_VTYPE_INT32:
|
||||||
uInfo(" %s:%s%d%s", cfg->option, blank, *((int32_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
|
uInfo(" %s:%s%d%s", cfg->option, blank, *((int32_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
|
||||||
break;
|
break;
|
||||||
|
case TAOS_CFG_VTYPE_UINT16:
|
||||||
|
uInfo(" %s:%s%d%s", cfg->option, blank, *((uint16_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
|
||||||
|
break;
|
||||||
case TAOS_CFG_VTYPE_FLOAT:
|
case TAOS_CFG_VTYPE_FLOAT:
|
||||||
uInfo(" %s:%s%f%s", cfg->option, blank, *((float *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
|
uInfo(" %s:%s%f%s", cfg->option, blank, *((float *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
|
||||||
break;
|
break;
|
||||||
|
@ -459,6 +482,9 @@ static void taosDumpCfg(SGlobalCfg *cfg) {
|
||||||
case TAOS_CFG_VTYPE_INT32:
|
case TAOS_CFG_VTYPE_INT32:
|
||||||
printf(" %s:%s%d%s\n", cfg->option, blank, *((int32_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
|
printf(" %s:%s%d%s\n", cfg->option, blank, *((int32_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
|
||||||
break;
|
break;
|
||||||
|
case TAOS_CFG_VTYPE_UINT16:
|
||||||
|
printf(" %s:%s%d%s\n", cfg->option, blank, *((uint16_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
|
||||||
|
break;
|
||||||
case TAOS_CFG_VTYPE_FLOAT:
|
case TAOS_CFG_VTYPE_FLOAT:
|
||||||
printf(" %s:%s%f%s\n", cfg->option, blank, *((float *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
|
printf(" %s:%s%f%s\n", cfg->option, blank, *((float *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -467,7 +467,6 @@ int main(int argc, char *argv[]) {
|
||||||
const char* passwd = "taosdata";
|
const char* passwd = "taosdata";
|
||||||
|
|
||||||
taos_options(TSDB_OPTION_TIMEZONE, "GMT-8");
|
taos_options(TSDB_OPTION_TIMEZONE, "GMT-8");
|
||||||
taos_init();
|
|
||||||
|
|
||||||
TAOS* taos = taos_connect(host, user, passwd, "", 0);
|
TAOS* taos = taos_connect(host, user, passwd, "", 0);
|
||||||
if (taos == NULL) {
|
if (taos == NULL) {
|
||||||
|
|
|
@ -99,8 +99,6 @@ int main(int argc, char *argv[])
|
||||||
tableList = (STable *)malloc(size);
|
tableList = (STable *)malloc(size);
|
||||||
memset(tableList, 0, size);
|
memset(tableList, 0, size);
|
||||||
|
|
||||||
taos_init();
|
|
||||||
|
|
||||||
taos = taos_connect(argv[1], "root", "taosdata", NULL, 0);
|
taos = taos_connect(argv[1], "root", "taosdata", NULL, 0);
|
||||||
if (taos == NULL)
|
if (taos == NULL)
|
||||||
taos_error(taos);
|
taos_error(taos);
|
||||||
|
|
|
@ -61,11 +61,6 @@ int main(int argc, char *argv[]) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// init TAOS
|
|
||||||
if (taos_init()) {
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
TAOS *taos = taos_connect(argv[1], "root", "taosdata", NULL, 0);
|
TAOS *taos = taos_connect(argv[1], "root", "taosdata", NULL, 0);
|
||||||
if (taos == NULL) {
|
if (taos == NULL) {
|
||||||
printf("failed to connect to server, reason:%s\n", "null taos"/*taos_errstr(taos)*/);
|
printf("failed to connect to server, reason:%s\n", "null taos"/*taos_errstr(taos)*/);
|
||||||
|
|
|
@ -6,7 +6,7 @@ TARGET=exe
|
||||||
LFLAGS = '-Wl,-rpath,/usr/local/taos/driver/' -ltaos -lpthread -lm -lrt
|
LFLAGS = '-Wl,-rpath,/usr/local/taos/driver/' -ltaos -lpthread -lm -lrt
|
||||||
CFLAGS = -O3 -g -Wall -Wno-deprecated -fPIC -Wno-unused-result -Wconversion \
|
CFLAGS = -O3 -g -Wall -Wno-deprecated -fPIC -Wno-unused-result -Wconversion \
|
||||||
-Wno-char-subscripts -D_REENTRANT -Wno-format -D_REENTRANT -DLINUX \
|
-Wno-char-subscripts -D_REENTRANT -Wno-format -D_REENTRANT -DLINUX \
|
||||||
-msse4.2 -Wno-unused-function -D_M_X64 -I/usr/local/taos/include -std=gnu99
|
-Wno-unused-function -D_M_X64 -I/usr/local/taos/include -std=gnu99
|
||||||
|
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,6 @@ int main(int argc, char *argv[])
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// init TAOS
|
|
||||||
if (taos_init()) {
|
|
||||||
printf("failed to init taos\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
taos = taos_connect(argv[1], "root", "taosdata", NULL, 0);
|
taos = taos_connect(argv[1], "root", "taosdata", NULL, 0);
|
||||||
if (taos == NULL) {
|
if (taos == NULL) {
|
||||||
printf("failed to connect to db, reason:%s\n", taos_errstr(taos));
|
printf("failed to connect to db, reason:%s\n", taos_errstr(taos));
|
||||||
|
|
|
@ -54,12 +54,6 @@ int main(int argc, char *argv[])
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// init TAOS
|
|
||||||
if (taos_init()) {
|
|
||||||
printf("failed to init taos\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
strcpy(db_name, argv[2]);
|
strcpy(db_name, argv[2]);
|
||||||
strcpy(tbl_name, argv[3]);
|
strcpy(tbl_name, argv[3]);
|
||||||
|
|
||||||
|
|
|
@ -216,12 +216,6 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// init TAOS
|
|
||||||
if (taos_init()) {
|
|
||||||
printf("failed to init taos\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
TAOS* taos = taos_connect(host, user, passwd, "", 0);
|
TAOS* taos = taos_connect(host, user, passwd, "", 0);
|
||||||
if (taos == NULL) {
|
if (taos == NULL) {
|
||||||
printf("failed to connect to db, reason:%s\n", taos_errstr(taos));
|
printf("failed to connect to db, reason:%s\n", taos_errstr(taos));
|
||||||
|
|
|
@ -19,6 +19,10 @@ class TDTestCase:
|
||||||
"double",
|
"double",
|
||||||
"smallint",
|
"smallint",
|
||||||
"tinyint",
|
"tinyint",
|
||||||
|
"int unsigned",
|
||||||
|
"bigint unsigned",
|
||||||
|
"smallint unsigned",
|
||||||
|
"tinyint unsigned",
|
||||||
"binary(10)",
|
"binary(10)",
|
||||||
"nchar(10)",
|
"nchar(10)",
|
||||||
"timestamp"]
|
"timestamp"]
|
||||||
|
|
|
@ -19,6 +19,10 @@ class TDTestCase:
|
||||||
"double",
|
"double",
|
||||||
"smallint",
|
"smallint",
|
||||||
"tinyint",
|
"tinyint",
|
||||||
|
"int unsigned",
|
||||||
|
"bigint unsigned",
|
||||||
|
"smallint unsigned",
|
||||||
|
"tinyint unsigned",
|
||||||
"binary(10)",
|
"binary(10)",
|
||||||
"nchar(10)",
|
"nchar(10)",
|
||||||
"timestamp"]
|
"timestamp"]
|
||||||
|
|
|
@ -66,6 +66,14 @@ class TDTestCase:
|
||||||
"alter table dt add column tbcol8 nchar(20)")
|
"alter table dt add column tbcol8 nchar(20)")
|
||||||
tdSql.execute(
|
tdSql.execute(
|
||||||
"alter table dt add column tbcol9 binary(20)")
|
"alter table dt add column tbcol9 binary(20)")
|
||||||
|
tdSql.execute(
|
||||||
|
"alter table dt add column tbcol10 tinyint unsigned")
|
||||||
|
tdSql.execute(
|
||||||
|
"alter table dt add column tbcol11 int unsigned")
|
||||||
|
tdSql.execute(
|
||||||
|
"alter table dt add column tbcol12 smallint unsigned")
|
||||||
|
tdSql.execute(
|
||||||
|
"alter table dt add column tbcol13 bigint unsigned")
|
||||||
|
|
||||||
# restart taosd
|
# restart taosd
|
||||||
tdDnodes.forcestop(1)
|
tdDnodes.forcestop(1)
|
||||||
|
|
|
@ -350,18 +350,27 @@ class ConcurrentInquiry:
|
||||||
cl.execute("create database if not exists %s;" %self.dbname)
|
cl.execute("create database if not exists %s;" %self.dbname)
|
||||||
cl.execute("use %s" % self.dbname)
|
cl.execute("use %s" % self.dbname)
|
||||||
for k in range(stableNum):
|
for k in range(stableNum):
|
||||||
sql="create table %s (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool,c8 binary(20),c9 nchar(20)) \
|
sql="create table %s (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool,c8 binary(20),c9 nchar(20),c11 int unsigned,c12 smallint unsigned,c13 tinyint unsigned,c14 bigint unsigned) \
|
||||||
tags(t1 int, t2 float, t3 bigint, t4 smallint, t5 tinyint, t6 double, t7 bool,t8 binary(20),t9 nchar(20))" % (self.stb_prefix+str(k))
|
tags(t1 int, t2 float, t3 bigint, t4 smallint, t5 tinyint, t6 double, t7 bool,t8 binary(20),t9 nchar(20), t11 int unsigned , t12 smallint unsigned , t13 tinyint unsigned , t14 bigint unsigned)" % (self.stb_prefix+str(k))
|
||||||
cl.execute(sql)
|
cl.execute(sql)
|
||||||
for j in range(subtableNum):
|
for j in range(subtableNum):
|
||||||
sql = "create table %s using %s tags(%d,%d,%d,%d,%d,%d,%d,'%s','%s')" % \
|
if j % 100 == 0:
|
||||||
(self.subtb_prefix+str(k)+'_'+str(j),self.stb_prefix+str(k),j,j/2.0,j%41,j%51,j%53,j*1.0,j%2,'taos'+str(j),'涛思'+str(j))
|
sql = "create table %s using %s tags(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)" % \
|
||||||
|
(self.subtb_prefix+str(k)+'_'+str(j),self.stb_prefix+str(k))
|
||||||
|
else:
|
||||||
|
sql = "create table %s using %s tags(%d,%d,%d,%d,%d,%d,%d,'%s','%s',%d,%d,%d,%d)" % \
|
||||||
|
(self.subtb_prefix+str(k)+'_'+str(j),self.stb_prefix+str(k),j,j/2.0,j%41,j%51,j%53,j*1.0,j%2,'taos'+str(j),'涛思'+str(j), j%43, j%23 , j%17 , j%3167)
|
||||||
print(sql)
|
print(sql)
|
||||||
cl.execute(sql)
|
cl.execute(sql)
|
||||||
for i in range(insertRows):
|
for i in range(insertRows):
|
||||||
|
if i % 100 == 0 :
|
||||||
ret = cl.execute(
|
ret = cl.execute(
|
||||||
"insert into %s values (%d , %d,%d,%d,%d,%d,%d,%d,'%s','%s')" %
|
"insert into %s values (%d , NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)" %
|
||||||
(self.subtb_prefix+str(k)+'_'+str(j),t0+i,i%100,i/2.0,i%41,i%51,i%53,i*1.0,i%2,'taos'+str(i),'涛思'+str(i)))
|
(self.subtb_prefix+str(k)+'_'+str(j), t0+i))
|
||||||
|
else:
|
||||||
|
ret = cl.execute(
|
||||||
|
"insert into %s values (%d , %d,%d,%d,%d,%d,%d,%d,'%s','%s',%d,%d,%d,%d)" %
|
||||||
|
(self.subtb_prefix+str(k)+'_'+str(j), t0+i, i%100, i/2.0, i%41, i%51, i%53, i*1.0, i%2,'taos'+str(i),'涛思'+str(i), i%43, i%23 , i%17 , i%3167))
|
||||||
cl.close()
|
cl.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,16 @@ ulimit -c unlimited
|
||||||
|
|
||||||
python3 ./test.py -f insert/basic.py
|
python3 ./test.py -f insert/basic.py
|
||||||
python3 ./test.py -f insert/int.py
|
python3 ./test.py -f insert/int.py
|
||||||
|
python3 ./test.py -f insert/unsignedInt.py
|
||||||
python3 ./test.py -f insert/float.py
|
python3 ./test.py -f insert/float.py
|
||||||
python3 ./test.py -f insert/bigint.py
|
python3 ./test.py -f insert/bigint.py
|
||||||
|
python3 ./test.py -f insert/unsignedBigint.py
|
||||||
python3 ./test.py -f insert/bool.py
|
python3 ./test.py -f insert/bool.py
|
||||||
python3 ./test.py -f insert/double.py
|
python3 ./test.py -f insert/double.py
|
||||||
python3 ./test.py -f insert/smallint.py
|
python3 ./test.py -f insert/smallint.py
|
||||||
|
python3 ./test.py -f insert/unsignedSmallint.py
|
||||||
python3 ./test.py -f insert/tinyint.py
|
python3 ./test.py -f insert/tinyint.py
|
||||||
|
python3 ./test.py -f insert/unsignedTinyint.py
|
||||||
python3 ./test.py -f insert/date.py
|
python3 ./test.py -f insert/date.py
|
||||||
python3 ./test.py -f insert/binary.py
|
python3 ./test.py -f insert/binary.py
|
||||||
python3 ./test.py -f insert/nchar.py
|
python3 ./test.py -f insert/nchar.py
|
||||||
|
@ -151,6 +155,7 @@ python3 ./test.py -f query/filterCombo.py
|
||||||
python3 ./test.py -f query/queryNormal.py
|
python3 ./test.py -f query/queryNormal.py
|
||||||
python3 ./test.py -f query/queryError.py
|
python3 ./test.py -f query/queryError.py
|
||||||
python3 ./test.py -f query/filterAllIntTypes.py
|
python3 ./test.py -f query/filterAllIntTypes.py
|
||||||
|
python3 ./test.py -f query/filterAllUnsignedIntTypes.py
|
||||||
python3 ./test.py -f query/filterFloatAndDouble.py
|
python3 ./test.py -f query/filterFloatAndDouble.py
|
||||||
python3 ./test.py -f query/filterOtherTypes.py
|
python3 ./test.py -f query/filterOtherTypes.py
|
||||||
python3 ./test.py -f query/querySort.py
|
python3 ./test.py -f query/querySort.py
|
||||||
|
|
|
@ -34,11 +34,11 @@ class TDTestCase:
|
||||||
floatData = []
|
floatData = []
|
||||||
|
|
||||||
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
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)) tags(loc nchar(20))''')
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
tdSql.execute("create table test1 using test tags('beijing')")
|
tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
tdSql.execute("insert into test1 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))
|
% (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)
|
intData.append(i + 1)
|
||||||
floatData.append(i + 0.1)
|
floatData.append(i + 0.1)
|
||||||
|
|
||||||
|
@ -64,6 +64,14 @@ class TDTestCase:
|
||||||
tdSql.checkData(0, 0, np.average(floatData))
|
tdSql.checkData(0, 0, np.average(floatData))
|
||||||
tdSql.query("select avg(col6) from test")
|
tdSql.query("select avg(col6) from test")
|
||||||
tdSql.checkData(0, 0, np.average(floatData))
|
tdSql.checkData(0, 0, np.average(floatData))
|
||||||
|
tdSql.query("select avg(col11) from test")
|
||||||
|
tdSql.checkData(0, 0, np.average(intData))
|
||||||
|
tdSql.query("select avg(col12) from test")
|
||||||
|
tdSql.checkData(0, 0, np.average(intData))
|
||||||
|
tdSql.query("select avg(col13) from test")
|
||||||
|
tdSql.checkData(0, 0, np.average(intData))
|
||||||
|
tdSql.query("select avg(col14) from test")
|
||||||
|
tdSql.checkData(0, 0, np.average(intData))
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
|
|
|
@ -34,11 +34,11 @@ class TDTestCase:
|
||||||
floatData = []
|
floatData = []
|
||||||
|
|
||||||
#tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
#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)) tags(loc nchar(20))''')
|
# col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
#tdSql.execute("create table test1 using test tags('beijing')")
|
#tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
#tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
#tdSql.execute("insert into test1 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))
|
# % (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)
|
intData.append(i + 1)
|
||||||
floatData.append(i + 0.1)
|
floatData.append(i + 0.1)
|
||||||
|
|
||||||
|
@ -64,6 +64,14 @@ class TDTestCase:
|
||||||
tdSql.checkData(0, 0, np.average(floatData))
|
tdSql.checkData(0, 0, np.average(floatData))
|
||||||
tdSql.query("select avg(col6) from test")
|
tdSql.query("select avg(col6) from test")
|
||||||
tdSql.checkData(0, 0, np.average(floatData))
|
tdSql.checkData(0, 0, np.average(floatData))
|
||||||
|
tdSql.query("select avg(col11) from test")
|
||||||
|
tdSql.checkData(0, 0, np.average(intData))
|
||||||
|
tdSql.query("select avg(col12) from test")
|
||||||
|
tdSql.checkData(0, 0, np.average(intData))
|
||||||
|
tdSql.query("select avg(col13) from test")
|
||||||
|
tdSql.checkData(0, 0, np.average(intData))
|
||||||
|
tdSql.query("select avg(col14) from test")
|
||||||
|
tdSql.checkData(0, 0, np.average(intData))
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
|
|
|
@ -31,11 +31,11 @@ class TDTestCase:
|
||||||
tdSql.prepare()
|
tdSql.prepare()
|
||||||
|
|
||||||
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
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)) tags(loc nchar(20))''')
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
tdSql.execute("create table test1 using test tags('beijing')")
|
tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
tdSql.execute("insert into test1 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))
|
% (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))
|
||||||
|
|
||||||
# bottom verifacation
|
# bottom verifacation
|
||||||
tdSql.error("select bottom(ts, 10) from test")
|
tdSql.error("select bottom(ts, 10) from test")
|
||||||
|
@ -85,6 +85,26 @@ class TDTestCase:
|
||||||
tdSql.checkData(0, 1, 0.1)
|
tdSql.checkData(0, 1, 0.1)
|
||||||
tdSql.checkData(1, 1, 1.1)
|
tdSql.checkData(1, 1, 1.1)
|
||||||
|
|
||||||
|
tdSql.query("select bottom(col11, 2) from test")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
tdSql.checkData(1, 1, 2)
|
||||||
|
|
||||||
|
tdSql.query("select bottom(col12, 2) from test")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
tdSql.checkData(1, 1, 2)
|
||||||
|
|
||||||
|
tdSql.query("select bottom(col13, 2) from test")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
tdSql.checkData(1, 1, 2)
|
||||||
|
|
||||||
|
tdSql.query("select bottom(col14, 2) from test")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
tdSql.checkData(1, 1, 2)
|
||||||
|
|
||||||
#TD-2457 bottom + interval + order by
|
#TD-2457 bottom + interval + order by
|
||||||
tdSql.error('select top(col2,1) from test interval(1y) order by col2;')
|
tdSql.error('select top(col2,1) from test interval(1y) order by col2;')
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,11 @@ class TDTestCase:
|
||||||
tdSql.execute("use db")
|
tdSql.execute("use db")
|
||||||
|
|
||||||
#tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
#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)) tags(loc nchar(20))''')
|
# col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
#tdSql.execute("create table test1 using test tags('beijing')")
|
#tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
#for i in range(self.rowNum):
|
#for i in range(self.rowNum):
|
||||||
# tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
# tdSql.execute("insert into test1 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))
|
# % (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))
|
||||||
|
|
||||||
# bottom verifacation
|
# bottom verifacation
|
||||||
tdSql.error("select bottom(ts, 10) from test")
|
tdSql.error("select bottom(ts, 10) from test")
|
||||||
|
@ -75,6 +75,26 @@ class TDTestCase:
|
||||||
tdSql.checkData(0, 1, 1)
|
tdSql.checkData(0, 1, 1)
|
||||||
tdSql.checkData(1, 1, 2)
|
tdSql.checkData(1, 1, 2)
|
||||||
|
|
||||||
|
tdSql.query("select bottom(col11, 2) from test")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
tdSql.checkData(1, 1, 2)
|
||||||
|
|
||||||
|
tdSql.query("select bottom(col12, 2) from test")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
tdSql.checkData(1, 1, 2)
|
||||||
|
|
||||||
|
tdSql.query("select bottom(col13, 2) from test")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
tdSql.checkData(1, 1, 2)
|
||||||
|
|
||||||
|
tdSql.query("select bottom(col14, 2) from test")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
tdSql.checkData(1, 1, 2)
|
||||||
|
|
||||||
tdSql.query("select bottom(col5, 2) from test")
|
tdSql.query("select bottom(col5, 2) from test")
|
||||||
tdSql.checkRows(2)
|
tdSql.checkRows(2)
|
||||||
tdSql.checkData(0, 1, 0.1)
|
tdSql.checkData(0, 1, 0.1)
|
||||||
|
|
|
@ -31,11 +31,11 @@ class TDTestCase:
|
||||||
tdSql.prepare()
|
tdSql.prepare()
|
||||||
|
|
||||||
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
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)) tags(loc nchar(20))''')
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
tdSql.execute("create table test1 using test tags('beijing')")
|
tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
tdSql.execute("insert into test1 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))
|
% (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))
|
||||||
|
|
||||||
# Count verifacation
|
# Count verifacation
|
||||||
tdSql.query("select count(*) from test")
|
tdSql.query("select count(*) from test")
|
||||||
|
@ -62,11 +62,20 @@ class TDTestCase:
|
||||||
tdSql.query("select count(col9) from test")
|
tdSql.query("select count(col9) from test")
|
||||||
tdSql.checkData(0, 0, 10)
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
|
tdSql.query("select count(col11) from test")
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select count(col12) from test")
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select count(col13) from test")
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select count(col14) from test")
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
tdSql.execute("alter table test add column col10 int")
|
tdSql.execute("alter table test add column col10 int")
|
||||||
tdSql.query("select count(col10) from test")
|
tdSql.query("select count(col10) from test")
|
||||||
tdSql.checkRows(0)
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
tdSql.execute("insert into test1 values(now, 1, 2, 3, 4, 1.1, 2.2, false, 'test', 'test' 1)")
|
tdSql.execute("insert into test1 values(now, 1, 2, 3, 4, 1.1, 2.2, false, 'test', 'test' , 1, 1, 1, 1, 1)")
|
||||||
tdSql.query("select count(col10) from test")
|
tdSql.query("select count(col10) from test")
|
||||||
tdSql.checkData(0, 0, 1)
|
tdSql.checkData(0, 0, 1)
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,11 @@ class TDTestCase:
|
||||||
tdSql.execute("use db")
|
tdSql.execute("use db")
|
||||||
|
|
||||||
#tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
#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)) tags(loc nchar(20))''')
|
# col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
#tdSql.execute("create table test1 using test tags('beijing')")
|
#tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
#for i in range(self.rowNum):
|
#for i in range(self.rowNum):
|
||||||
# tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
# tdSql.execute("insert into test1 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))
|
# % (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))
|
||||||
|
|
||||||
# Count verifacation
|
# Count verifacation
|
||||||
tdSql.query("select count(*) from test")
|
tdSql.query("select count(*) from test")
|
||||||
|
@ -62,6 +62,15 @@ class TDTestCase:
|
||||||
tdSql.query("select count(col9) from test")
|
tdSql.query("select count(col9) from test")
|
||||||
tdSql.checkData(0, 0, 11)
|
tdSql.checkData(0, 0, 11)
|
||||||
|
|
||||||
|
tdSql.query("select count(col11) from test")
|
||||||
|
tdSql.checkData(0, 0, 11)
|
||||||
|
tdSql.query("select count(col12) from test")
|
||||||
|
tdSql.checkData(0, 0, 11)
|
||||||
|
tdSql.query("select count(col13) from test")
|
||||||
|
tdSql.checkData(0, 0, 11)
|
||||||
|
tdSql.query("select count(col14) from test")
|
||||||
|
tdSql.checkData(0, 0, 11)
|
||||||
|
|
||||||
#tdSql.execute("alter table test add column col10 int")
|
#tdSql.execute("alter table test add column col10 int")
|
||||||
#tdSql.query("select count(col10) from test")
|
#tdSql.query("select count(col10) from test")
|
||||||
#tdSql.checkRows(0)
|
#tdSql.checkRows(0)
|
||||||
|
|
|
@ -31,9 +31,9 @@ class TDTestCase:
|
||||||
tdSql.prepare()
|
tdSql.prepare()
|
||||||
|
|
||||||
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
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)) tags(loc nchar(20))''')
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
tdSql.execute("create table test1 using test tags('beijing')")
|
tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
tdSql.execute("insert into test1 values(%d, 0, 0, 0, 0, 0.0, 0.0, False, ' ', ' ')" % (self.ts - 1))
|
tdSql.execute("insert into test1 values(%d, 0, 0, 0, 0, 0.0, 0.0, False, ' ', ' ', 0, 0, 0, 0)" % (self.ts - 1))
|
||||||
|
|
||||||
# diff verifacation
|
# diff verifacation
|
||||||
tdSql.query("select diff(col1) from test1")
|
tdSql.query("select diff(col1) from test1")
|
||||||
|
@ -55,8 +55,8 @@ class TDTestCase:
|
||||||
tdSql.checkRows(0)
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
tdSql.execute("insert into test1 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))
|
% (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))
|
||||||
|
|
||||||
tdSql.error("select diff(ts) from test")
|
tdSql.error("select diff(ts) from test")
|
||||||
tdSql.error("select diff(ts) from test1")
|
tdSql.error("select diff(ts) from test1")
|
||||||
|
@ -72,6 +72,15 @@ class TDTestCase:
|
||||||
tdSql.error("select diff(col8) from test1")
|
tdSql.error("select diff(col8) from test1")
|
||||||
tdSql.error("select diff(col9) from test")
|
tdSql.error("select diff(col9) from test")
|
||||||
tdSql.error("select diff(col9) from test1")
|
tdSql.error("select diff(col9) from test1")
|
||||||
|
tdSql.error("select diff(col11) from test1")
|
||||||
|
tdSql.error("select diff(col12) from test1")
|
||||||
|
tdSql.error("select diff(col13) from test1")
|
||||||
|
tdSql.error("select diff(col14) from test1")
|
||||||
|
tdSql.error("select diff(col11) from test")
|
||||||
|
tdSql.error("select diff(col12) from test")
|
||||||
|
tdSql.error("select diff(col13) from test")
|
||||||
|
tdSql.error("select diff(col14) from test")
|
||||||
|
|
||||||
|
|
||||||
tdSql.query("select diff(col1) from test1")
|
tdSql.query("select diff(col1) from test1")
|
||||||
tdSql.checkRows(10)
|
tdSql.checkRows(10)
|
||||||
|
|
|
@ -31,7 +31,7 @@ class TDTestCase:
|
||||||
tdSql.execute("use db")
|
tdSql.execute("use db")
|
||||||
|
|
||||||
#tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
#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)) tags(loc nchar(20))''')
|
# col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
#tdSql.execute("create table test1 using test tags('beijing')")
|
#tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
#tdSql.execute("insert into test1 values(%d, 0, 0, 0, 0, 0.0, 0.0, False, ' ', ' ')" % (self.ts - 1))
|
#tdSql.execute("insert into test1 values(%d, 0, 0, 0, 0, 0.0, 0.0, False, ' ', ' ')" % (self.ts - 1))
|
||||||
|
|
||||||
|
@ -55,8 +55,8 @@ class TDTestCase:
|
||||||
#tdSql.checkRows(0)
|
#tdSql.checkRows(0)
|
||||||
|
|
||||||
#for i in range(self.rowNum):
|
#for i in range(self.rowNum):
|
||||||
# tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
# tdSql.execute("insert into test1 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))
|
# % (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))
|
||||||
|
|
||||||
tdSql.error("select diff(ts) from test")
|
tdSql.error("select diff(ts) from test")
|
||||||
tdSql.error("select diff(ts) from test1")
|
tdSql.error("select diff(ts) from test1")
|
||||||
|
@ -71,7 +71,14 @@ class TDTestCase:
|
||||||
tdSql.error("select diff(col8) from test")
|
tdSql.error("select diff(col8) from test")
|
||||||
tdSql.error("select diff(col8) from test1")
|
tdSql.error("select diff(col8) from test1")
|
||||||
tdSql.error("select diff(col9) from test")
|
tdSql.error("select diff(col9) from test")
|
||||||
tdSql.error("select diff(col9) from test1")
|
tdSql.error("select diff(col11) from test1")
|
||||||
|
tdSql.error("select diff(col12) from test1")
|
||||||
|
tdSql.error("select diff(col13) from test1")
|
||||||
|
tdSql.error("select diff(col14) from test1")
|
||||||
|
tdSql.error("select diff(col11) from test")
|
||||||
|
tdSql.error("select diff(col12) from test")
|
||||||
|
tdSql.error("select diff(col13) from test")
|
||||||
|
tdSql.error("select diff(col14) from test")
|
||||||
|
|
||||||
tdSql.query("select diff(col1) from test1")
|
tdSql.query("select diff(col1) from test1")
|
||||||
tdSql.checkRows(10)
|
tdSql.checkRows(10)
|
||||||
|
|
|
@ -31,7 +31,7 @@ class TDTestCase:
|
||||||
tdSql.prepare()
|
tdSql.prepare()
|
||||||
|
|
||||||
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
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)) tags(loc nchar(20))''')
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
tdSql.execute("create table test1 using test tags('beijing')")
|
tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
tdSql.execute("insert into test1(ts) values(%d)" % (self.ts - 1))
|
tdSql.execute("insert into test1(ts) values(%d)" % (self.ts - 1))
|
||||||
|
|
||||||
|
@ -52,6 +52,18 @@ class TDTestCase:
|
||||||
tdSql.query("select first(col4) from test1")
|
tdSql.query("select first(col4) from test1")
|
||||||
tdSql.checkRows(0)
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
|
tdSql.query("select first(col11) from test1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
|
tdSql.query("select first(col12) from test1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
|
tdSql.query("select first(col13) from test1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
|
tdSql.query("select first(col14) from test1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
tdSql.query("select first(col5) from test1")
|
tdSql.query("select first(col5) from test1")
|
||||||
tdSql.checkRows(0)
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
|
@ -68,8 +80,8 @@ class TDTestCase:
|
||||||
tdSql.checkRows(0)
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
tdSql.execute("insert into test1 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))
|
% (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))
|
||||||
|
|
||||||
tdSql.query("select first(*) from test1")
|
tdSql.query("select first(*) from test1")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
|
@ -91,6 +103,22 @@ class TDTestCase:
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 1)
|
tdSql.checkData(0, 0, 1)
|
||||||
|
|
||||||
|
tdSql.query("select first(col11) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 1)
|
||||||
|
|
||||||
|
tdSql.query("select first(col12) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 1)
|
||||||
|
|
||||||
|
tdSql.query("select first(col13) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 1)
|
||||||
|
|
||||||
|
tdSql.query("select first(col14) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 1)
|
||||||
|
|
||||||
tdSql.query("select first(col5) from test1")
|
tdSql.query("select first(col5) from test1")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 0.1)
|
tdSql.checkData(0, 0, 0.1)
|
||||||
|
|
|
@ -31,7 +31,7 @@ class TDTestCase:
|
||||||
tdSql.prepare()
|
tdSql.prepare()
|
||||||
|
|
||||||
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
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)) tags(loc nchar(20))''')
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
tdSql.execute("create table test1 using test tags('beijing')")
|
tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
tdSql.execute("insert into test1(ts) values(%d)" % (self.ts - 1))
|
tdSql.execute("insert into test1(ts) values(%d)" % (self.ts - 1))
|
||||||
|
|
||||||
|
@ -52,6 +52,18 @@ class TDTestCase:
|
||||||
tdSql.query("select last(col4) from test1")
|
tdSql.query("select last(col4) from test1")
|
||||||
tdSql.checkRows(0)
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
|
tdSql.query("select last(col11) from test1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
|
tdSql.query("select last(col12) from test1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
|
tdSql.query("select last(col13) from test1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
|
tdSql.query("select last(col14) from test1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
tdSql.query("select last(col5) from test1")
|
tdSql.query("select last(col5) from test1")
|
||||||
tdSql.checkRows(0)
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
|
@ -68,8 +80,8 @@ class TDTestCase:
|
||||||
tdSql.checkRows(0)
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
tdSql.execute("insert into test1 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))
|
% (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))
|
||||||
|
|
||||||
tdSql.query("select last(*) from test1")
|
tdSql.query("select last(*) from test1")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
|
@ -91,6 +103,22 @@ class TDTestCase:
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 10)
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
|
tdSql.query("select last(col11) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
|
tdSql.query("select last(col12) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
|
tdSql.query("select last(col13) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
|
tdSql.query("select last(col14) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
tdSql.query("select last(col5) from test1")
|
tdSql.query("select last(col5) from test1")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 9.1)
|
tdSql.checkData(0, 0, 9.1)
|
||||||
|
|
|
@ -31,7 +31,7 @@ class TDTestCase:
|
||||||
tdSql.prepare()
|
tdSql.prepare()
|
||||||
|
|
||||||
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
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)) tags(loc nchar(20))''')
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
tdSql.execute("create table test1 using test tags('beijing')")
|
tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
tdSql.execute("insert into test1(ts) values(%d)" % (self.ts - 1))
|
tdSql.execute("insert into test1(ts) values(%d)" % (self.ts - 1))
|
||||||
|
|
||||||
|
@ -56,6 +56,22 @@ class TDTestCase:
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, None)
|
tdSql.checkData(0, 0, None)
|
||||||
|
|
||||||
|
tdSql.query("select last_row(col11) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, None)
|
||||||
|
|
||||||
|
tdSql.query("select last_row(col12) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, None)
|
||||||
|
|
||||||
|
tdSql.query("select last_row(col13) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, None)
|
||||||
|
|
||||||
|
tdSql.query("select last_row(col14) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, None)
|
||||||
|
|
||||||
tdSql.query("select last_row(col5) from test1")
|
tdSql.query("select last_row(col5) from test1")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, None)
|
tdSql.checkData(0, 0, None)
|
||||||
|
@ -77,8 +93,8 @@ class TDTestCase:
|
||||||
tdSql.checkData(0, 0, None)
|
tdSql.checkData(0, 0, None)
|
||||||
|
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
tdSql.execute("insert into test1 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))
|
% (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))
|
||||||
|
|
||||||
tdSql.query("select last_row(*) from test1")
|
tdSql.query("select last_row(*) from test1")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
|
@ -100,6 +116,22 @@ class TDTestCase:
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 10)
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
|
tdSql.query("select last_row(col11) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
|
tdSql.query("select last_row(col12) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
|
tdSql.query("select last_row(col13) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
|
tdSql.query("select last_row(col14) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
tdSql.query("select last_row(col5) from test1")
|
tdSql.query("select last_row(col5) from test1")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 9.1)
|
tdSql.checkData(0, 0, 9.1)
|
||||||
|
|
|
@ -31,11 +31,11 @@ class TDTestCase:
|
||||||
tdSql.prepare()
|
tdSql.prepare()
|
||||||
|
|
||||||
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
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)) tags(loc nchar(20))''')
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
tdSql.execute("create table test1 using test tags('beijing')")
|
tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
tdSql.execute("insert into test1 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))
|
% (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))
|
||||||
|
|
||||||
# leastsquares verifacation
|
# leastsquares verifacation
|
||||||
tdSql.error("select leastsquares(ts, 1, 1) from test1")
|
tdSql.error("select leastsquares(ts, 1, 1) from test1")
|
||||||
|
@ -48,6 +48,10 @@ class TDTestCase:
|
||||||
tdSql.error("select leastsquares(col7, 1, 1) from test1")
|
tdSql.error("select leastsquares(col7, 1, 1) from test1")
|
||||||
tdSql.error("select leastsquares(col8, 1, 1) from test1")
|
tdSql.error("select leastsquares(col8, 1, 1) from test1")
|
||||||
tdSql.error("select leastsquares(col9, 1, 1) from test1")
|
tdSql.error("select leastsquares(col9, 1, 1) from test1")
|
||||||
|
tdSql.error("select leastsquares(col11, 1, 1) from test")
|
||||||
|
tdSql.error("select leastsquares(col12, 1, 1) from test")
|
||||||
|
tdSql.error("select leastsquares(col13, 1, 1) from test")
|
||||||
|
tdSql.error("select leastsquares(col14, 1, 1) from test")
|
||||||
|
|
||||||
tdSql.query("select leastsquares(col1, 1, 1) from test1")
|
tdSql.query("select leastsquares(col1, 1, 1) from test1")
|
||||||
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
|
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
|
||||||
|
@ -61,6 +65,18 @@ class TDTestCase:
|
||||||
tdSql.query("select leastsquares(col4, 1, 1) from test1")
|
tdSql.query("select leastsquares(col4, 1, 1) from test1")
|
||||||
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
|
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
|
||||||
|
|
||||||
|
tdSql.query("select leastsquares(col11, 1, 1) from test1")
|
||||||
|
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
|
||||||
|
|
||||||
|
tdSql.query("select leastsquares(col12, 1, 1) from test1")
|
||||||
|
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
|
||||||
|
|
||||||
|
tdSql.query("select leastsquares(col13, 1, 1) from test1")
|
||||||
|
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
|
||||||
|
|
||||||
|
tdSql.query("select leastsquares(col14, 1, 1) from test1")
|
||||||
|
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
|
||||||
|
|
||||||
tdSql.query("select leastsquares(col5, 1, 1) from test1")
|
tdSql.query("select leastsquares(col5, 1, 1) from test1")
|
||||||
tdSql.checkData(0, 0, '{slop:1.000000, intercept:-0.900000}')
|
tdSql.checkData(0, 0, '{slop:1.000000, intercept:-0.900000}')
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,18 @@ class TDTestCase:
|
||||||
tdSql.query("select leastsquares(col4, 1, 1) from test1")
|
tdSql.query("select leastsquares(col4, 1, 1) from test1")
|
||||||
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
|
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
|
||||||
|
|
||||||
|
tdSql.query("select leastsquares(col11, 1, 1) from test1")
|
||||||
|
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
|
||||||
|
|
||||||
|
tdSql.query("select leastsquares(col12, 1, 1) from test1")
|
||||||
|
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
|
||||||
|
|
||||||
|
tdSql.query("select leastsquares(col13, 1, 1) from test1")
|
||||||
|
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
|
||||||
|
|
||||||
|
tdSql.query("select leastsquares(col14, 1, 1) from test1")
|
||||||
|
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
|
||||||
|
|
||||||
tdSql.query("select leastsquares(col5, 1, 1) from test1")
|
tdSql.query("select leastsquares(col5, 1, 1) from test1")
|
||||||
tdSql.checkData(0, 0, '{slop:1.000000, intercept:-0.900000}')
|
tdSql.checkData(0, 0, '{slop:1.000000, intercept:-0.900000}')
|
||||||
|
|
||||||
|
|
|
@ -34,11 +34,11 @@ class TDTestCase:
|
||||||
floatData = []
|
floatData = []
|
||||||
|
|
||||||
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
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)) tags(loc nchar(20))''')
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
tdSql.execute("create table test1 using test tags('beijing')")
|
tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
tdSql.execute("insert into test1 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))
|
% (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)
|
intData.append(i + 1)
|
||||||
floatData.append(i + 0.1)
|
floatData.append(i + 0.1)
|
||||||
|
|
||||||
|
@ -64,6 +64,18 @@ class TDTestCase:
|
||||||
tdSql.query("select max(col4) from test1")
|
tdSql.query("select max(col4) from test1")
|
||||||
tdSql.checkData(0, 0, np.max(intData))
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
|
||||||
|
tdSql.query("select max(col11) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
|
||||||
|
tdSql.query("select max(col12) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
|
||||||
|
tdSql.query("select max(col13) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
|
||||||
|
tdSql.query("select max(col14) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
|
||||||
tdSql.query("select max(col5) from test1")
|
tdSql.query("select max(col5) from test1")
|
||||||
tdSql.checkData(0, 0, np.max(floatData))
|
tdSql.checkData(0, 0, np.max(floatData))
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ class TDTestCase:
|
||||||
floatData = []
|
floatData = []
|
||||||
|
|
||||||
#tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
#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)) tags(loc nchar(20))''')
|
# col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
#tdSql.execute("create table test1 using test tags('beijing')")
|
#tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
intData.append(i + 1)
|
intData.append(i + 1)
|
||||||
|
@ -62,6 +62,18 @@ class TDTestCase:
|
||||||
tdSql.query("select max(col4) from test1")
|
tdSql.query("select max(col4) from test1")
|
||||||
tdSql.checkData(0, 0, np.max(intData))
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
|
||||||
|
tdSql.query("select max(col11) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
|
||||||
|
tdSql.query("select max(col12) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
|
||||||
|
tdSql.query("select max(col13) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
|
||||||
|
tdSql.query("select max(col14) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
|
||||||
tdSql.query("select max(col5) from test1")
|
tdSql.query("select max(col5) from test1")
|
||||||
tdSql.checkData(0, 0, np.max(floatData))
|
tdSql.checkData(0, 0, np.max(floatData))
|
||||||
|
|
||||||
|
|
|
@ -34,11 +34,11 @@ class TDTestCase:
|
||||||
floatData = []
|
floatData = []
|
||||||
|
|
||||||
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
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)) tags(loc nchar(20))''')
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
tdSql.execute("create table test1 using test tags('beijing')")
|
tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
tdSql.execute("insert into test1 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))
|
% (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)
|
intData.append(i + 1)
|
||||||
floatData.append(i + 0.1)
|
floatData.append(i + 0.1)
|
||||||
|
|
||||||
|
@ -64,6 +64,18 @@ class TDTestCase:
|
||||||
tdSql.query("select min(col4) from test1")
|
tdSql.query("select min(col4) from test1")
|
||||||
tdSql.checkData(0, 0, np.min(intData))
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
|
||||||
|
tdSql.query("select min(col11) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
|
||||||
|
tdSql.query("select min(col12) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
|
||||||
|
tdSql.query("select min(col13) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
|
||||||
|
tdSql.query("select min(col14) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
|
||||||
tdSql.query("select min(col5) from test1")
|
tdSql.query("select min(col5) from test1")
|
||||||
tdSql.checkData(0, 0, np.min(floatData))
|
tdSql.checkData(0, 0, np.min(floatData))
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,18 @@ class TDTestCase:
|
||||||
tdSql.query("select min(col4) from test1")
|
tdSql.query("select min(col4) from test1")
|
||||||
tdSql.checkData(0, 0, np.min(intData))
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
|
||||||
|
tdSql.query("select min(col11) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
|
||||||
|
tdSql.query("select min(col12) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
|
||||||
|
tdSql.query("select min(col13) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
|
||||||
|
tdSql.query("select min(col14) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
|
||||||
tdSql.query("select min(col5) from test1")
|
tdSql.query("select min(col5) from test1")
|
||||||
tdSql.checkData(0, 0, np.min(floatData))
|
tdSql.checkData(0, 0, np.min(floatData))
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,11 @@ class TDTestCase:
|
||||||
tdSql.prepare()
|
tdSql.prepare()
|
||||||
|
|
||||||
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
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)) tags(loc nchar(20))''')
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
tdSql.execute("create table test1 using test tags('beijing')")
|
tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
tdSql.execute("insert into test1 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))
|
% (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))
|
||||||
|
|
||||||
# min verifacation
|
# min verifacation
|
||||||
tdSql.error("select ts + col1 from test")
|
tdSql.error("select ts + col1 from test")
|
||||||
|
@ -51,9 +51,9 @@ class TDTestCase:
|
||||||
tdSql.checkRows(10)
|
tdSql.checkRows(10)
|
||||||
tdSql.checkData(0, 0, 2.0)
|
tdSql.checkData(0, 0, 2.0)
|
||||||
|
|
||||||
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 from test1")
|
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 + col11 + col12 + col13 + col14 from test1")
|
||||||
tdSql.checkRows(10)
|
tdSql.checkRows(10)
|
||||||
tdSql.checkData(0, 0, 3.2)
|
tdSql.checkData(0, 0, 7.2)
|
||||||
|
|
||||||
tdSql.execute("insert into test1(ts, col1) values(%d, 11)" % (self.ts + 11))
|
tdSql.execute("insert into test1(ts, col1) values(%d, 11)" % (self.ts + 11))
|
||||||
tdSql.query("select col1 + col2 from test1")
|
tdSql.query("select col1 + col2 from test1")
|
||||||
|
@ -64,10 +64,19 @@ class TDTestCase:
|
||||||
tdSql.checkRows(11)
|
tdSql.checkRows(11)
|
||||||
tdSql.checkData(10, 0, None)
|
tdSql.checkData(10, 0, None)
|
||||||
|
|
||||||
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 from test1")
|
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 + col11 + col12 + col13 + col14 from test1")
|
||||||
tdSql.checkRows(11)
|
tdSql.checkRows(11)
|
||||||
tdSql.checkData(10, 0, None)
|
tdSql.checkData(10, 0, None)
|
||||||
|
|
||||||
|
# test for tarithoperator.c coverage
|
||||||
|
col_list = [ 'col1' , 'col2' , 'col3' , 'col4' , 'col5' , 'col6' , 'col11' , 'col12' , 'col13' , 'col14' , '1' ]
|
||||||
|
op_list = [ '+' , '-' , '*' , '/' , '%' ]
|
||||||
|
for i in col_list :
|
||||||
|
for j in col_list :
|
||||||
|
for k in op_list :
|
||||||
|
sql = " select %s %s %s from test1 " % ( i , k , j )
|
||||||
|
print(sql)
|
||||||
|
tdSql.query(sql)
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
|
|
|
@ -44,9 +44,9 @@ class TDTestCase:
|
||||||
tdSql.checkRows(11)
|
tdSql.checkRows(11)
|
||||||
tdSql.checkData(0, 0, 2.0)
|
tdSql.checkData(0, 0, 2.0)
|
||||||
|
|
||||||
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 from test1")
|
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 + col11 + col12 + col13 + col14 from test1")
|
||||||
tdSql.checkRows(11)
|
tdSql.checkRows(11)
|
||||||
tdSql.checkData(0, 0, 3.2)
|
tdSql.checkData(0, 0, 7.2)
|
||||||
|
|
||||||
#tdSql.execute("insert into test1(ts, col1) values(%d, 11)" % (self.ts + 11))
|
#tdSql.execute("insert into test1(ts, col1) values(%d, 11)" % (self.ts + 11))
|
||||||
tdSql.query("select col1 + col2 from test1")
|
tdSql.query("select col1 + col2 from test1")
|
||||||
|
@ -57,7 +57,7 @@ class TDTestCase:
|
||||||
tdSql.checkRows(11)
|
tdSql.checkRows(11)
|
||||||
tdSql.checkData(10, 0, None)
|
tdSql.checkData(10, 0, None)
|
||||||
|
|
||||||
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 from test1")
|
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 + col11 + col12 + col13 + col14 from test1")
|
||||||
tdSql.checkRows(11)
|
tdSql.checkRows(11)
|
||||||
tdSql.checkData(10, 0, None)
|
tdSql.checkData(10, 0, None)
|
||||||
|
|
||||||
|
|
|
@ -34,10 +34,10 @@ class TDTestCase:
|
||||||
floatData = []
|
floatData = []
|
||||||
|
|
||||||
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
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))''')
|
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):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into test values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
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))
|
% (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)
|
intData.append(i + 1)
|
||||||
floatData.append(i + 0.1)
|
floatData.append(i + 0.1)
|
||||||
|
|
||||||
|
@ -103,6 +103,58 @@ class TDTestCase:
|
||||||
tdSql.query("select apercentile(col4, 100) from test")
|
tdSql.query("select apercentile(col4, 100) from test")
|
||||||
print("apercentile result: %s" % tdSql.getData(0, 0))
|
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")
|
tdSql.query("select percentile(col5, 0) from test")
|
||||||
print("query result: %s" % tdSql.getData(0, 0))
|
print("query result: %s" % tdSql.getData(0, 0))
|
||||||
print("array result: %s" % np.percentile(floatData, 0))
|
print("array result: %s" % np.percentile(floatData, 0))
|
||||||
|
|
|
@ -99,6 +99,58 @@ class TDTestCase:
|
||||||
tdSql.query("select apercentile(col4, 100) from test")
|
tdSql.query("select apercentile(col4, 100) from test")
|
||||||
print("apercentile result: %s" % tdSql.getData(0, 0))
|
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")
|
tdSql.query("select percentile(col5, 0) from test")
|
||||||
print("query result: %s" % tdSql.getData(0, 0))
|
print("query result: %s" % tdSql.getData(0, 0))
|
||||||
print("array result: %s" % np.percentile(floatData, 0))
|
print("array result: %s" % np.percentile(floatData, 0))
|
||||||
|
|
|
@ -31,9 +31,9 @@ class TDTestCase:
|
||||||
tdSql.prepare()
|
tdSql.prepare()
|
||||||
|
|
||||||
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
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)) tags(loc nchar(20))''')
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
tdSql.execute("create table test1 using test tags('beijing')")
|
tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
tdSql.execute("insert into test1 values(%d, 0, 0, 0, 0, 0.0, 0.0, False, ' ', ' ')" % (self.ts - 1))
|
tdSql.execute("insert into test1 values(%d, 0, 0, 0, 0, 0.0, 0.0, False, ' ', ' ', 0, 0, 0, 0)" % (self.ts - 1))
|
||||||
|
|
||||||
# spread verifacation
|
# spread verifacation
|
||||||
tdSql.query("select spread(ts) from test1")
|
tdSql.query("select spread(ts) from test1")
|
||||||
|
@ -55,6 +55,22 @@ class TDTestCase:
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 0)
|
tdSql.checkData(0, 0, 0)
|
||||||
|
|
||||||
|
tdSql.query("select spread(col11) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 0)
|
||||||
|
|
||||||
|
tdSql.query("select spread(col12) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 0)
|
||||||
|
|
||||||
|
tdSql.query("select spread(col13) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 0)
|
||||||
|
|
||||||
|
tdSql.query("select spread(col14) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 0)
|
||||||
|
|
||||||
tdSql.query("select spread(col5) from test1")
|
tdSql.query("select spread(col5) from test1")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 0)
|
tdSql.checkData(0, 0, 0)
|
||||||
|
@ -64,8 +80,8 @@ class TDTestCase:
|
||||||
tdSql.checkData(0, 0, 0)
|
tdSql.checkData(0, 0, 0)
|
||||||
|
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
tdSql.execute("insert into test1 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))
|
% (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))
|
||||||
|
|
||||||
tdSql.error("select spread(col7) from test")
|
tdSql.error("select spread(col7) from test")
|
||||||
tdSql.error("select spread(col7) from test1")
|
tdSql.error("select spread(col7) from test1")
|
||||||
|
@ -90,6 +106,22 @@ class TDTestCase:
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 10)
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
|
tdSql.query("select spread(col11) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
|
tdSql.query("select spread(col12) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
|
tdSql.query("select spread(col13) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
|
tdSql.query("select spread(col14) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
tdSql.query("select spread(col5) from test1")
|
tdSql.query("select spread(col5) from test1")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 9.1)
|
tdSql.checkData(0, 0, 9.1)
|
||||||
|
|
|
@ -53,6 +53,23 @@ class TDTestCase:
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 10)
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
|
tdSql.query("select spread(col11) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
|
tdSql.query("select spread(col12) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
|
tdSql.query("select spread(col13) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
|
tdSql.query("select spread(col14) from test1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
|
|
||||||
tdSql.query("select spread(col5) from test1")
|
tdSql.query("select spread(col5) from test1")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 9.1)
|
tdSql.checkData(0, 0, 9.1)
|
||||||
|
|
|
@ -34,11 +34,11 @@ class TDTestCase:
|
||||||
floatData = []
|
floatData = []
|
||||||
|
|
||||||
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
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)) tags(loc nchar(20))''')
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
tdSql.execute("create table test1 using test tags('beijing')")
|
tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
tdSql.execute("insert into test1 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))
|
% (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)
|
intData.append(i + 1)
|
||||||
floatData.append(i + 0.1)
|
floatData.append(i + 0.1)
|
||||||
|
|
||||||
|
@ -68,6 +68,18 @@ class TDTestCase:
|
||||||
tdSql.query("select stddev(col4) from test1")
|
tdSql.query("select stddev(col4) from test1")
|
||||||
tdSql.checkData(0, 0, np.std(intData))
|
tdSql.checkData(0, 0, np.std(intData))
|
||||||
|
|
||||||
|
tdSql.query("select stddev(col11) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.std(intData))
|
||||||
|
|
||||||
|
tdSql.query("select stddev(col12) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.std(intData))
|
||||||
|
|
||||||
|
tdSql.query("select stddev(col13) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.std(intData))
|
||||||
|
|
||||||
|
tdSql.query("select stddev(col14) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.std(intData))
|
||||||
|
|
||||||
tdSql.query("select stddev(col5) from test1")
|
tdSql.query("select stddev(col5) from test1")
|
||||||
tdSql.checkData(0, 0, np.std(floatData))
|
tdSql.checkData(0, 0, np.std(floatData))
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,18 @@ class TDTestCase:
|
||||||
tdSql.query("select stddev(col4) from test1")
|
tdSql.query("select stddev(col4) from test1")
|
||||||
tdSql.checkData(0, 0, np.std(intData))
|
tdSql.checkData(0, 0, np.std(intData))
|
||||||
|
|
||||||
|
tdSql.query("select stddev(col11) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.std(intData))
|
||||||
|
|
||||||
|
tdSql.query("select stddev(col12) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.std(intData))
|
||||||
|
|
||||||
|
tdSql.query("select stddev(col13) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.std(intData))
|
||||||
|
|
||||||
|
tdSql.query("select stddev(col14) from test1")
|
||||||
|
tdSql.checkData(0, 0, np.std(intData))
|
||||||
|
|
||||||
tdSql.query("select stddev(col5) from test1")
|
tdSql.query("select stddev(col5) from test1")
|
||||||
tdSql.checkData(0, 0, np.std(floatData))
|
tdSql.checkData(0, 0, np.std(floatData))
|
||||||
|
|
||||||
|
|
|
@ -32,25 +32,31 @@ class TDTestCase:
|
||||||
self.clist4 = []
|
self.clist4 = []
|
||||||
self.clist5 = []
|
self.clist5 = []
|
||||||
self.clist6 = []
|
self.clist6 = []
|
||||||
|
self.clist11 = []
|
||||||
|
self.clist12 = []
|
||||||
|
self.clist13 = []
|
||||||
|
self.clist14 = []
|
||||||
|
|
||||||
def getData(self):
|
def getData(self):
|
||||||
for i in range(tdSql.queryRows):
|
for i in range(tdSql.queryRows):
|
||||||
for j in range(6):
|
for j in range(6):
|
||||||
exec('self.clist{}.append(tdSql.queryResult[i][j+1])'.format(j+1))
|
exec('self.clist{}.append(tdSql.queryResult[i][j+1])'.format(j+1))
|
||||||
|
for j in range(11,15):
|
||||||
|
exec('self.clist{}.append(tdSql.queryResult[i][j-1])'.format(j))
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
tdSql.prepare()
|
tdSql.prepare()
|
||||||
|
|
||||||
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
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)) tags(cid int,gbid binary(20),loc nchar(20))''')
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(cid int,gbid binary(20),loc nchar(20))''')
|
||||||
tdSql.execute("create table test1 using test tags(1,'beijing','北京')")
|
tdSql.execute("create table test1 using test tags(1,'beijing','北京')")
|
||||||
tdSql.execute("create table test2 using test tags(2,'shanghai','深圳')")
|
tdSql.execute("create table test2 using test tags(2,'shanghai','深圳')")
|
||||||
tdSql.execute("create table test3 using test tags(2,'shenzhen','深圳')")
|
tdSql.execute("create table test3 using test tags(2,'shenzhen','深圳')")
|
||||||
tdSql.execute("create table test4 using test tags(1,'shanghai','上海')")
|
tdSql.execute("create table test4 using test tags(1,'shanghai','上海')")
|
||||||
for j in range(4):
|
for j in range(4):
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into test%d values(now-%dh, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
tdSql.execute("insert into test%d values(now-%dh, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
|
||||||
% (j+1,i, i + 1, i + 1, i + 1, i + 1, i + i * 0.1, i * 1.5, i % 2, i + 1, i + 1))
|
% (j+1,i, i + 1, i + 1, i + 1, i + 1, i + i * 0.1, i * 1.5, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
|
||||||
|
|
||||||
# stddev verifacation
|
# stddev verifacation
|
||||||
tdSql.error("select stddev(ts) from test")
|
tdSql.error("select stddev(ts) from test")
|
||||||
|
@ -70,6 +76,10 @@ class TDTestCase:
|
||||||
exec('tdSql.query("select stddev(col{}) from test {}")'.format(i+1,condition))
|
exec('tdSql.query("select stddev(col{}) from test {}")'.format(i+1,condition))
|
||||||
exec('tdSql.checkData(0, 0, np.std(self.clist{}))'.format(i+1))
|
exec('tdSql.checkData(0, 0, np.std(self.clist{}))'.format(i+1))
|
||||||
exec('self.clist{}.clear()'.format(i+1))
|
exec('self.clist{}.clear()'.format(i+1))
|
||||||
|
for i in range(11,15):
|
||||||
|
exec('tdSql.query("select stddev(col{}) from test {}")'.format(i,condition))
|
||||||
|
exec('tdSql.checkData(0, 0, np.std(self.clist{}))'.format(i))
|
||||||
|
exec('self.clist{}.clear()'.format(i))
|
||||||
print('step 2')
|
print('step 2')
|
||||||
con_group_list = {
|
con_group_list = {
|
||||||
' cid = 2 and ts >=now - 1d and ts <now group by tbname':2,
|
' cid = 2 and ts >=now - 1d and ts <now group by tbname':2,
|
||||||
|
@ -82,6 +92,10 @@ class TDTestCase:
|
||||||
exec('tdSql.query("select stddev(col{}) from test where {}")'.format(i+1,key))
|
exec('tdSql.query("select stddev(col{}) from test where {}")'.format(i+1,key))
|
||||||
for j in range(value):
|
for j in range(value):
|
||||||
tdSql.checkData(j, 0, result[i])
|
tdSql.checkData(j, 0, result[i])
|
||||||
|
for i in range(11,15):
|
||||||
|
exec('tdSql.query("select stddev(col{}) from test where {}")'.format(i,key))
|
||||||
|
for j in range(value):
|
||||||
|
tdSql.checkData(j, 0, result[0])
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
|
|
|
@ -34,11 +34,11 @@ class TDTestCase:
|
||||||
floatData = []
|
floatData = []
|
||||||
|
|
||||||
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
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)) tags(loc nchar(20))''')
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
tdSql.execute("create table test1 using test tags('beijing')")
|
tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
tdSql.execute("insert into test1 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))
|
% (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)
|
intData.append(i + 1)
|
||||||
floatData.append(i + 0.1)
|
floatData.append(i + 0.1)
|
||||||
|
|
||||||
|
@ -56,6 +56,14 @@ class TDTestCase:
|
||||||
tdSql.checkData(0, 0, np.sum(intData))
|
tdSql.checkData(0, 0, np.sum(intData))
|
||||||
tdSql.query("select sum(col4) from test")
|
tdSql.query("select sum(col4) from test")
|
||||||
tdSql.checkData(0, 0, np.sum(intData))
|
tdSql.checkData(0, 0, np.sum(intData))
|
||||||
|
tdSql.query("select sum(col11) from test")
|
||||||
|
tdSql.checkData(0, 0, np.sum(intData))
|
||||||
|
tdSql.query("select sum(col12) from test")
|
||||||
|
tdSql.checkData(0, 0, np.sum(intData))
|
||||||
|
tdSql.query("select sum(col13) from test")
|
||||||
|
tdSql.checkData(0, 0, np.sum(intData))
|
||||||
|
tdSql.query("select sum(col14) from test")
|
||||||
|
tdSql.checkData(0, 0, np.sum(intData))
|
||||||
tdSql.query("select sum(col5) from test")
|
tdSql.query("select sum(col5) from test")
|
||||||
tdSql.checkData(0, 0, np.sum(floatData))
|
tdSql.checkData(0, 0, np.sum(floatData))
|
||||||
tdSql.query("select sum(col6) from test")
|
tdSql.query("select sum(col6) from test")
|
||||||
|
|
|
@ -51,6 +51,13 @@ class TDTestCase:
|
||||||
tdSql.checkData(0, 0, np.sum(intData))
|
tdSql.checkData(0, 0, np.sum(intData))
|
||||||
tdSql.query("select sum(col4) from test")
|
tdSql.query("select sum(col4) from test")
|
||||||
tdSql.checkData(0, 0, np.sum(intData))
|
tdSql.checkData(0, 0, np.sum(intData))
|
||||||
|
tdSql.query("select sum(col11) from test")
|
||||||
|
tdSql.checkData(0, 0, np.sum(intData))
|
||||||
|
tdSql.query("select sum(col12) from test")
|
||||||
|
tdSql.checkData(0, 0, np.sum(intData))
|
||||||
|
tdSql.query("select sum(col13) from test")
|
||||||
|
tdSql.checkData(0, 0, np.sum(intData))
|
||||||
|
tdSql.query("select sum(col14) from test")
|
||||||
tdSql.query("select sum(col5) from test")
|
tdSql.query("select sum(col5) from test")
|
||||||
tdSql.checkData(0, 0, np.sum(floatData))
|
tdSql.checkData(0, 0, np.sum(floatData))
|
||||||
tdSql.query("select sum(col6) from test")
|
tdSql.query("select sum(col6) from test")
|
||||||
|
|
|
@ -34,11 +34,11 @@ class TDTestCase:
|
||||||
floatData = []
|
floatData = []
|
||||||
|
|
||||||
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
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)) tags(loc nchar(20))''')
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
tdSql.execute("create table test1 using test tags('beijing')")
|
tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
tdSql.execute("insert into test1 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))
|
% (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)
|
intData.append(i + 1)
|
||||||
floatData.append(i + 0.1)
|
floatData.append(i + 0.1)
|
||||||
|
|
||||||
|
@ -59,6 +59,14 @@ class TDTestCase:
|
||||||
tdSql.error("select top(col7, 10) from test")
|
tdSql.error("select top(col7, 10) from test")
|
||||||
tdSql.error("select top(col8, 10) from test")
|
tdSql.error("select top(col8, 10) from test")
|
||||||
tdSql.error("select top(col9, 10) from test")
|
tdSql.error("select top(col9, 10) from test")
|
||||||
|
tdSql.error("select top(col11, 0) from test")
|
||||||
|
tdSql.error("select top(col11, 101) from test")
|
||||||
|
tdSql.error("select top(col12, 0) from test")
|
||||||
|
tdSql.error("select top(col12, 101) from test")
|
||||||
|
tdSql.error("select top(col13, 0) from test")
|
||||||
|
tdSql.error("select top(col13, 101) from test")
|
||||||
|
tdSql.error("select top(col14, 0) from test")
|
||||||
|
tdSql.error("select top(col14, 101) from test")
|
||||||
|
|
||||||
tdSql.query("select top(col1, 2) from test")
|
tdSql.query("select top(col1, 2) from test")
|
||||||
tdSql.checkRows(2)
|
tdSql.checkRows(2)
|
||||||
|
@ -80,6 +88,26 @@ class TDTestCase:
|
||||||
tdSql.checkData(0, 1, 9)
|
tdSql.checkData(0, 1, 9)
|
||||||
tdSql.checkData(1, 1, 10)
|
tdSql.checkData(1, 1, 10)
|
||||||
|
|
||||||
|
tdSql.query("select top(col11, 2) from test")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.checkData(0, 1, 9)
|
||||||
|
tdSql.checkData(1, 1, 10)
|
||||||
|
|
||||||
|
tdSql.query("select top(col12, 2) from test")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.checkData(0, 1, 9)
|
||||||
|
tdSql.checkData(1, 1, 10)
|
||||||
|
|
||||||
|
tdSql.query("select top(col13, 2) from test")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.checkData(0, 1, 9)
|
||||||
|
tdSql.checkData(1, 1, 10)
|
||||||
|
|
||||||
|
tdSql.query("select top(col14, 2) from test")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.checkData(0, 1, 9)
|
||||||
|
tdSql.checkData(1, 1, 10)
|
||||||
|
|
||||||
tdSql.query("select top(col5, 2) from test")
|
tdSql.query("select top(col5, 2) from test")
|
||||||
tdSql.checkRows(2)
|
tdSql.checkRows(2)
|
||||||
tdSql.checkData(0, 1, 8.1)
|
tdSql.checkData(0, 1, 8.1)
|
||||||
|
|
|
@ -75,6 +75,26 @@ class TDTestCase:
|
||||||
tdSql.checkData(0, 1, 9)
|
tdSql.checkData(0, 1, 9)
|
||||||
tdSql.checkData(1, 1, 10)
|
tdSql.checkData(1, 1, 10)
|
||||||
|
|
||||||
|
tdSql.query("select top(col11, 2) from test")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.checkData(0, 1, 9)
|
||||||
|
tdSql.checkData(1, 1, 10)
|
||||||
|
|
||||||
|
tdSql.query("select top(col12, 2) from test")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.checkData(0, 1, 9)
|
||||||
|
tdSql.checkData(1, 1, 10)
|
||||||
|
|
||||||
|
tdSql.query("select top(col13, 2) from test")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.checkData(0, 1, 9)
|
||||||
|
tdSql.checkData(1, 1, 10)
|
||||||
|
|
||||||
|
tdSql.query("select top(col14, 2) from test")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.checkData(0, 1, 9)
|
||||||
|
tdSql.checkData(1, 1, 10)
|
||||||
|
|
||||||
tdSql.query("select top(col5, 2) from test")
|
tdSql.query("select top(col5, 2) from test")
|
||||||
tdSql.checkRows(2)
|
tdSql.checkRows(2)
|
||||||
tdSql.checkData(0, 1, 8.1)
|
tdSql.checkData(0, 1, 8.1)
|
||||||
|
|
|
@ -34,11 +34,11 @@ class TDTestCase:
|
||||||
floatData = []
|
floatData = []
|
||||||
|
|
||||||
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
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)) tags(loc nchar(20))''')
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
tdSql.execute("create table test1 using test tags('beijing')")
|
tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
tdSql.execute("insert into test1 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))
|
% (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)
|
intData.append(i + 1)
|
||||||
floatData.append(i + 0.1)
|
floatData.append(i + 0.1)
|
||||||
|
|
||||||
|
@ -54,6 +54,14 @@ class TDTestCase:
|
||||||
|
|
||||||
tdSql.error("select twa(col4) from test")
|
tdSql.error("select twa(col4) from test")
|
||||||
|
|
||||||
|
tdSql.error("select twa(col11) from test")
|
||||||
|
|
||||||
|
tdSql.error("select twa(col12) from test")
|
||||||
|
|
||||||
|
tdSql.error("select twa(col13) from test")
|
||||||
|
|
||||||
|
tdSql.error("select twa(col14) from test")
|
||||||
|
|
||||||
tdSql.error("select twa(col5) from test")
|
tdSql.error("select twa(col5) from test")
|
||||||
|
|
||||||
tdSql.error("select twa(col6) from test")
|
tdSql.error("select twa(col6) from test")
|
||||||
|
@ -79,6 +87,18 @@ class TDTestCase:
|
||||||
tdSql.error("select twa(col4) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
tdSql.error("select twa(col4) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
tdSql.query("select twa(col4) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
tdSql.query("select twa(col4) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
|
||||||
|
tdSql.error("select twa(col11) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
tdSql.query("select twa(col11) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
|
||||||
|
tdSql.error("select twa(col12) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
tdSql.query("select twa(col12) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
|
||||||
|
tdSql.error("select twa(col13) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
tdSql.query("select twa(col13) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
|
||||||
|
tdSql.error("select twa(col14) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
tdSql.query("select twa(col14) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
|
||||||
tdSql.error("select twa(col5) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
tdSql.error("select twa(col5) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
tdSql.query("select twa(col5) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
tdSql.query("select twa(col5) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
|
||||||
|
|
|
@ -34,11 +34,11 @@ class TDTestCase:
|
||||||
floatData = []
|
floatData = []
|
||||||
|
|
||||||
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
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)) tags(loc nchar(20))''')
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
tdSql.execute("create table test1 using test tags('beijing')")
|
tdSql.execute("create table test1 using test tags('beijing')")
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
|
tdSql.execute("insert into test1 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))
|
% (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)
|
intData.append(i + 1)
|
||||||
floatData.append(i + 0.1)
|
floatData.append(i + 0.1)
|
||||||
|
|
||||||
|
@ -54,6 +54,14 @@ class TDTestCase:
|
||||||
|
|
||||||
tdSql.error("select twa(col4) from test")
|
tdSql.error("select twa(col4) from test")
|
||||||
|
|
||||||
|
tdSql.error("select twa(col11) from test")
|
||||||
|
|
||||||
|
tdSql.error("select twa(col12) from test")
|
||||||
|
|
||||||
|
tdSql.error("select twa(col13) from test")
|
||||||
|
|
||||||
|
tdSql.error("select twa(col14) from test")
|
||||||
|
|
||||||
tdSql.error("select twa(col5) from test")
|
tdSql.error("select twa(col5) from test")
|
||||||
|
|
||||||
tdSql.error("select twa(col6) from test")
|
tdSql.error("select twa(col6) from test")
|
||||||
|
@ -79,6 +87,18 @@ class TDTestCase:
|
||||||
tdSql.error("select twa(col4) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
tdSql.error("select twa(col4) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
tdSql.query("select twa(col4) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
tdSql.query("select twa(col4) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
|
||||||
|
tdSql.error("select twa(col11) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
tdSql.query("select twa(col11) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
|
||||||
|
tdSql.error("select twa(col12) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
tdSql.query("select twa(col12) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
|
||||||
|
tdSql.error("select twa(col13) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
tdSql.query("select twa(col13) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
|
||||||
|
tdSql.error("select twa(col14) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
tdSql.query("select twa(col14) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
|
||||||
tdSql.error("select twa(col5) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
tdSql.error("select twa(col5) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
tdSql.query("select twa(col5) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
tdSql.query("select twa(col5) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class TDTestCase:
|
||||||
(i, i))
|
(i, i))
|
||||||
|
|
||||||
tdLog.info("insert earlier data")
|
tdLog.info("insert earlier data")
|
||||||
tdSql.execute('insert into tb values (now - 5m , 10)')
|
tdSql.execute('insert into tb values (now - 5m , NULL)')
|
||||||
tdSql.execute('insert into tb values (now - 6m , 10)')
|
tdSql.execute('insert into tb values (now - 6m , 10)')
|
||||||
tdSql.execute('insert into tb values (now - 7m , NULL)')
|
tdSql.execute('insert into tb values (now - 7m , NULL)')
|
||||||
tdSql.execute('insert into tb values (now - 8m , 254)')
|
tdSql.execute('insert into tb values (now - 8m , 254)')
|
||||||
|
|
|
@ -0,0 +1,108 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
|
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(), logSql)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
tdLog.info('=============== step1')
|
||||||
|
tdLog.info('create table tb (ts timestamp, speed bigint unsigned)')
|
||||||
|
tdSql.execute('create table tb (ts timestamp, speed bigint unsigned)')
|
||||||
|
tdLog.info("insert into tb values (now, NULL)")
|
||||||
|
tdSql.execute("insert into tb values (now, NULL)")
|
||||||
|
tdLog.info('select * from tb order by ts desc')
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdLog.info('tdSql.checkRow(1)')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, null)')
|
||||||
|
tdSql.checkData(0, 1, None)
|
||||||
|
tdLog.info('=============== step2')
|
||||||
|
tdLog.info("insert into tb values (now+1m, -1) -x step2")
|
||||||
|
tdSql.error("insert into tb values (now+1m, -1) ")
|
||||||
|
tdLog.info("insert into tb values (now+1m, NULL)")
|
||||||
|
tdSql.execute("insert into tb values (now+1m, NULL)")
|
||||||
|
tdLog.info('select * from tb order by ts desc')
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdLog.info('tdSql.checkRow(2)')
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, null)')
|
||||||
|
tdSql.checkData(0, 1, None)
|
||||||
|
tdLog.info('=============== step3')
|
||||||
|
tdLog.info("insert into tb values (now+2m, 18446744073709551614)")
|
||||||
|
tdSql.execute("insert into tb values (now+2m, 18446744073709551614)")
|
||||||
|
tdLog.info('select * from tb order by ts desc')
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdLog.info('tdSql.checkRow(3)')
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 18446744073709551614)')
|
||||||
|
tdSql.checkData(0, 1, 18446744073709551614)
|
||||||
|
tdLog.info('=============== step4')
|
||||||
|
tdLog.info("insert into tb values (now+3m, 18446744073709551615) -x step4")
|
||||||
|
tdSql.error("insert into tb values (now+3m, 18446744073709551615)")
|
||||||
|
tdLog.info("insert into tb values (now+3m, NULL)")
|
||||||
|
tdSql.execute("insert into tb values (now+3m, NULL)")
|
||||||
|
tdLog.info('select * from tb')
|
||||||
|
tdSql.query('select * from tb')
|
||||||
|
tdLog.info('tdSql.checkRow(4)')
|
||||||
|
tdSql.checkRows(4)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, null)')
|
||||||
|
tdSql.checkData(0, 1, None)
|
||||||
|
tdLog.info('=============== step5')
|
||||||
|
tdLog.info("insert into tb values (now+4m, a2)")
|
||||||
|
tdSql.error("insert into tb values (now+4m, a2)")
|
||||||
|
tdLog.info("insert into tb values (now-4m, -1)")
|
||||||
|
tdSql.error("insert into tb values (now-4m, -1)")
|
||||||
|
tdLog.info("insert into tb values (now+4m, 0)")
|
||||||
|
tdSql.execute("insert into tb values (now+4m, 0)")
|
||||||
|
tdLog.info('select * from tb order by ts desc')
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdLog.info('tdSql.checkRow(5)')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 0)')
|
||||||
|
tdSql.checkData(0, 1, 0)
|
||||||
|
tdLog.info('=============== step6')
|
||||||
|
tdLog.info("insert into tb values (now+5m, 2a)")
|
||||||
|
tdSql.error("insert into tb values (now+5m, 2a)")
|
||||||
|
tdLog.info("insert into tb values (now+5m, 2)")
|
||||||
|
tdSql.execute("insert into tb values (now+5m, 2)")
|
||||||
|
tdLog.info('select * from tb order by ts desc')
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdLog.info('tdSql.checkRow(6)')
|
||||||
|
tdSql.checkRows(6)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 2)')
|
||||||
|
tdSql.checkData(0, 1, 2)
|
||||||
|
tdLog.info('=============== step7')
|
||||||
|
tdLog.info("insert into tb values (now+6m, 2a'1)")
|
||||||
|
tdSql.error("insert into tb values (now+6m, 2a'1)")
|
||||||
|
tdLog.info("insert into tb values (now+6m, 2)")
|
||||||
|
tdSql.execute("insert into tb values (now+6m, 2)")
|
||||||
|
tdLog.info('select * from tb order by ts desc')
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdLog.info('tdSql.checkRow(7)')
|
||||||
|
tdSql.checkRows(7)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 2)')
|
||||||
|
tdSql.checkData(0, 1, 2)
|
||||||
|
tdLog.info('drop database db')
|
||||||
|
tdSql.execute('drop database db')
|
||||||
|
tdLog.info('show databases')
|
||||||
|
tdSql.query('show databases')
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# convert end
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -0,0 +1,108 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
|
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(), logSql)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
tdLog.info('=============== step1')
|
||||||
|
tdLog.info('create table tb (ts timestamp, speed int unsigned)')
|
||||||
|
tdSql.execute('create table tb (ts timestamp, speed int unsigned)')
|
||||||
|
tdLog.info("insert into tb values (now, NULL)")
|
||||||
|
tdSql.execute("insert into tb values (now, NULL)")
|
||||||
|
tdLog.info('select * from tb order by ts desc')
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdLog.info('tdSql.checkRow(1)')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, null)')
|
||||||
|
tdSql.checkData(0, 1, None)
|
||||||
|
tdLog.info('=============== step2')
|
||||||
|
tdLog.info("insert into tb values (now+1m, -1) -x step2")
|
||||||
|
tdSql.error("insert into tb values (now+1m, -1) ")
|
||||||
|
tdLog.info("insert into tb values (now+1m, NULL)")
|
||||||
|
tdSql.execute("insert into tb values (now+1m, NULL)")
|
||||||
|
tdLog.info('select * from tb order by ts desc')
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdLog.info('tdSql.checkRow(2)')
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, null)')
|
||||||
|
tdSql.checkData(0, 1, None)
|
||||||
|
tdLog.info('=============== step3')
|
||||||
|
tdLog.info("insert into tb values (now+2m, 4294967294)")
|
||||||
|
tdSql.execute("insert into tb values (now+2m, 4294967294)")
|
||||||
|
tdLog.info('select * from tb order by ts desc')
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdLog.info('tdSql.checkRow(3)')
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 4294967294)')
|
||||||
|
tdSql.checkData(0, 1, 4294967294)
|
||||||
|
tdLog.info('=============== step4')
|
||||||
|
tdLog.info("insert into tb values (now+3m, 4294967295) -x step4")
|
||||||
|
tdSql.error("insert into tb values (now+3m, 4294967295)")
|
||||||
|
tdLog.info("insert into tb values (now+3m, NULL)")
|
||||||
|
tdSql.execute("insert into tb values (now+3m, NULL)")
|
||||||
|
tdLog.info('select * from tb')
|
||||||
|
tdSql.query('select * from tb')
|
||||||
|
tdLog.info('tdSql.checkRow(4)')
|
||||||
|
tdSql.checkRows(4)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, null)')
|
||||||
|
tdSql.checkData(0, 1, None)
|
||||||
|
tdLog.info('=============== step5')
|
||||||
|
tdLog.info("insert into tb values (now+4m, a2)")
|
||||||
|
tdSql.error("insert into tb values (now+4m, a2)")
|
||||||
|
tdLog.info("insert into tb values (now-4m, -1)")
|
||||||
|
tdSql.error("insert into tb values (now-4m, -1)")
|
||||||
|
tdLog.info("insert into tb values (now+4m, 0)")
|
||||||
|
tdSql.execute("insert into tb values (now+4m, 0)")
|
||||||
|
tdLog.info('select * from tb order by ts desc')
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdLog.info('tdSql.checkRow(5)')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 0)')
|
||||||
|
tdSql.checkData(0, 1, 0)
|
||||||
|
tdLog.info('=============== step6')
|
||||||
|
tdLog.info("insert into tb values (now+5m, 2a)")
|
||||||
|
tdSql.error("insert into tb values (now+5m, 2a)")
|
||||||
|
tdLog.info("insert into tb values (now+5m, 2)")
|
||||||
|
tdSql.execute("insert into tb values (now+5m, 2)")
|
||||||
|
tdLog.info('select * from tb order by ts desc')
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdLog.info('tdSql.checkRow(6)')
|
||||||
|
tdSql.checkRows(6)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 2)')
|
||||||
|
tdSql.checkData(0, 1, 2)
|
||||||
|
tdLog.info('=============== step7')
|
||||||
|
tdLog.info("insert into tb values (now+6m, 2a'1)")
|
||||||
|
tdSql.error("insert into tb values (now+6m, 2a'1)")
|
||||||
|
tdLog.info("insert into tb values (now+6m, 2)")
|
||||||
|
tdSql.execute("insert into tb values (now+6m, 2)")
|
||||||
|
tdLog.info('select * from tb order by ts desc')
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdLog.info('tdSql.checkRow(7)')
|
||||||
|
tdSql.checkRows(7)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 2)')
|
||||||
|
tdSql.checkData(0, 1, 2)
|
||||||
|
tdLog.info('drop database db')
|
||||||
|
tdSql.execute('drop database db')
|
||||||
|
tdLog.info('show databases')
|
||||||
|
tdSql.query('show databases')
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# convert end
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -0,0 +1,108 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
|
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(), logSql)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
tdLog.info('=============== step1')
|
||||||
|
tdLog.info('create table tb (ts timestamp, speed smallint unsigned)')
|
||||||
|
tdSql.execute('create table tb (ts timestamp, speed smallint unsigned)')
|
||||||
|
tdLog.info("insert into tb values (now, NULL)")
|
||||||
|
tdSql.execute("insert into tb values (now, NULL)")
|
||||||
|
tdLog.info('select * from tb order by ts desc')
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdLog.info('tdSql.checkRow(1)')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, null)')
|
||||||
|
tdSql.checkData(0, 1, None)
|
||||||
|
tdLog.info('=============== step2')
|
||||||
|
tdLog.info("insert into tb values (now+1m, -1) -x step2")
|
||||||
|
tdSql.error("insert into tb values (now+1m, -1) ")
|
||||||
|
tdLog.info("insert into tb values (now+1m, NULL)")
|
||||||
|
tdSql.execute("insert into tb values (now+1m, NULL)")
|
||||||
|
tdLog.info('select * from tb order by ts desc')
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdLog.info('tdSql.checkRow(2)')
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, null)')
|
||||||
|
tdSql.checkData(0, 1, None)
|
||||||
|
tdLog.info('=============== step3')
|
||||||
|
tdLog.info("insert into tb values (now+2m, 65534)")
|
||||||
|
tdSql.execute("insert into tb values (now+2m, 65534)")
|
||||||
|
tdLog.info('select * from tb order by ts desc')
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdLog.info('tdSql.checkRow(3)')
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 65534)')
|
||||||
|
tdSql.checkData(0, 1, 65534)
|
||||||
|
tdLog.info('=============== step4')
|
||||||
|
tdLog.info("insert into tb values (now+3m, 65535) -x step4")
|
||||||
|
tdSql.error("insert into tb values (now+3m, 65535)")
|
||||||
|
tdLog.info("insert into tb values (now+3m, NULL)")
|
||||||
|
tdSql.execute("insert into tb values (now+3m, NULL)")
|
||||||
|
tdLog.info('select * from tb')
|
||||||
|
tdSql.query('select * from tb')
|
||||||
|
tdLog.info('tdSql.checkRow(4)')
|
||||||
|
tdSql.checkRows(4)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, null)')
|
||||||
|
tdSql.checkData(0, 1, None)
|
||||||
|
tdLog.info('=============== step5')
|
||||||
|
tdLog.info("insert into tb values (now+4m, a2)")
|
||||||
|
tdSql.error("insert into tb values (now+4m, a2)")
|
||||||
|
tdLog.info("insert into tb values (now-4m, -1)")
|
||||||
|
tdSql.error("insert into tb values (now-4m, -1)")
|
||||||
|
tdLog.info("insert into tb values (now+4m, 0)")
|
||||||
|
tdSql.execute("insert into tb values (now+4m, 0)")
|
||||||
|
tdLog.info('select * from tb order by ts desc')
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdLog.info('tdSql.checkRow(5)')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 0)')
|
||||||
|
tdSql.checkData(0, 1, 0)
|
||||||
|
tdLog.info('=============== step6')
|
||||||
|
tdLog.info("insert into tb values (now+5m, 2a)")
|
||||||
|
tdSql.error("insert into tb values (now+5m, 2a)")
|
||||||
|
tdLog.info("insert into tb values (now+5m, 2)")
|
||||||
|
tdSql.execute("insert into tb values (now+5m, 2)")
|
||||||
|
tdLog.info('select * from tb order by ts desc')
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdLog.info('tdSql.checkRow(6)')
|
||||||
|
tdSql.checkRows(6)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 2)')
|
||||||
|
tdSql.checkData(0, 1, 2)
|
||||||
|
tdLog.info('=============== step7')
|
||||||
|
tdLog.info("insert into tb values (now+6m, 2a'1)")
|
||||||
|
tdSql.error("insert into tb values (now+6m, 2a'1)")
|
||||||
|
tdLog.info("insert into tb values (now+6m, 2)")
|
||||||
|
tdSql.execute("insert into tb values (now+6m, 2)")
|
||||||
|
tdLog.info('select * from tb order by ts desc')
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdLog.info('tdSql.checkRow(7)')
|
||||||
|
tdSql.checkRows(7)
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 2)')
|
||||||
|
tdSql.checkData(0, 1, 2)
|
||||||
|
tdLog.info('drop database db')
|
||||||
|
tdSql.execute('drop database db')
|
||||||
|
tdLog.info('show databases')
|
||||||
|
tdSql.query('show databases')
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# convert end
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -95,7 +95,7 @@ class TDTestCase:
|
||||||
tdSql.query('show databases')
|
tdSql.query('show databases')
|
||||||
tdLog.info('tdSql.checkRow(0)')
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
tdSql.checkRows(0)
|
tdSql.checkRows(0)
|
||||||
# convert end
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
|
@ -31,3 +31,9 @@ python3 ./test.py -f query/last_row_cache.py
|
||||||
python3 ./test.py -f account/account_create.py
|
python3 ./test.py -f account/account_create.py
|
||||||
python3 ./test.py -f alter/alter_table.py
|
python3 ./test.py -f alter/alter_table.py
|
||||||
python3 ./test.py -f query/queryGroupbySort.py
|
python3 ./test.py -f query/queryGroupbySort.py
|
||||||
|
|
||||||
|
python3 ./test.py -f insert/unsignedInt.py
|
||||||
|
python3 ./test.py -f insert/unsignedBigint.py
|
||||||
|
python3 ./test.py -f insert/unsignedSmallint.py
|
||||||
|
python3 ./test.py -f insert/unsignedTinyint.py
|
||||||
|
python3 ./test.py -f query/filterAllUnsignedIntTypes.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 taos
|
||||||
|
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.powers = [8, 16, 32, 64]
|
||||||
|
self.types = ["tinyint", "smallint", "int", "bigint"]
|
||||||
|
self.rowNum = 10
|
||||||
|
self.ts = 1537146000000
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
for i in range(len(self.powers)):
|
||||||
|
curType = self.types[i]
|
||||||
|
print("======= Verify filter for %s type =========" % (curType))
|
||||||
|
tdLog.debug(
|
||||||
|
"create table st%s(ts timestamp, num %s unsigned) tags(id %s unsigned)" %
|
||||||
|
(curType, curType, curType))
|
||||||
|
tdSql.execute(
|
||||||
|
"create table st%s(ts timestamp, num %s unsigned) tags(id %s unsigned)" %
|
||||||
|
(curType, curType, curType))
|
||||||
|
|
||||||
|
# create 10 tables, insert 10 rows for each table
|
||||||
|
for j in range(self.rowNum):
|
||||||
|
tdSql.execute(
|
||||||
|
"create table st%s%d using st%s tags(%d)" %
|
||||||
|
(curType, j + 1, curType, j + 1))
|
||||||
|
for k in range(self.rowNum):
|
||||||
|
tdSql.execute(
|
||||||
|
"insert into st%s%d values(%d, %d)" %
|
||||||
|
(curType, j + 1, self.ts + k + 1, j * 10 + k + 1))
|
||||||
|
|
||||||
|
tdSql.error("insert into st%s10 values(%d, %d)" %
|
||||||
|
(curType, self.ts + 11, pow(2, self.powers[i]) - 1 ))
|
||||||
|
tdSql.execute("insert into st%s10 values(%d, %d)" %
|
||||||
|
(curType, self.ts + 12, pow(2, self.powers[i]) - 2 ))
|
||||||
|
tdSql.error("insert into st%s10 values(%d, %d)" %
|
||||||
|
(curType, self.ts + 13, -1 ))
|
||||||
|
tdSql.execute("insert into st%s10 values(%d, %d)" %
|
||||||
|
(curType, self.ts + 14, 0 ))
|
||||||
|
# select all data
|
||||||
|
# tdSql.query("select * from st%s " % curType)
|
||||||
|
# tdSql.checkRows(102)
|
||||||
|
|
||||||
|
# > for int type on column
|
||||||
|
tdSql.query("select * from st%s where num > 50" % curType)
|
||||||
|
tdSql.checkRows(51)
|
||||||
|
|
||||||
|
# >= for int type on column
|
||||||
|
tdSql.query("select * from st%s where num >= 50" % curType)
|
||||||
|
tdSql.checkRows(52)
|
||||||
|
|
||||||
|
# = for int type on column
|
||||||
|
tdSql.query("select * from st%s where num = 50" % curType)
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
|
||||||
|
# < for int type on column
|
||||||
|
tdSql.query("select * from st%s where num < 50" % curType)
|
||||||
|
tdSql.checkRows(50)
|
||||||
|
|
||||||
|
# <= for int type on column
|
||||||
|
tdSql.query("select * from st%s where num <= 50" % curType)
|
||||||
|
tdSql.checkRows(51)
|
||||||
|
|
||||||
|
# <> for int type on column
|
||||||
|
tdSql.query("select * from st%s where num <> 50" % curType)
|
||||||
|
tdSql.checkRows(101)
|
||||||
|
|
||||||
|
# != for int type on column
|
||||||
|
tdSql.query("select * from st%s where num != 50" % curType)
|
||||||
|
tdSql.checkRows(101)
|
||||||
|
|
||||||
|
# range for int type on column
|
||||||
|
tdSql.query(
|
||||||
|
"select * from st%s where num > 50 and num < 100" %
|
||||||
|
curType)
|
||||||
|
tdSql.checkRows(49)
|
||||||
|
|
||||||
|
tdSql.query(
|
||||||
|
"select * from st%s where num >= 50 and num < 100" %
|
||||||
|
curType)
|
||||||
|
tdSql.checkRows(50)
|
||||||
|
|
||||||
|
tdSql.query(
|
||||||
|
"select * from st%s where num > 50 and num <= 100" %
|
||||||
|
curType)
|
||||||
|
tdSql.checkRows(50)
|
||||||
|
|
||||||
|
tdSql.query(
|
||||||
|
"select * from st%s where num >= 50 and num <= 100" %
|
||||||
|
curType)
|
||||||
|
tdSql.checkRows(51)
|
||||||
|
|
||||||
|
# > for int type on tag
|
||||||
|
tdSql.query("select * from st%s where id > 5" % curType)
|
||||||
|
tdSql.checkRows(52)
|
||||||
|
|
||||||
|
# >= for int type on tag
|
||||||
|
tdSql.query("select * from st%s where id >= 5" % curType)
|
||||||
|
tdSql.checkRows(62)
|
||||||
|
|
||||||
|
# = for int type on tag
|
||||||
|
tdSql.query("select * from st%s where id = 5" % curType)
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
|
||||||
|
# < for int type on tag
|
||||||
|
tdSql.query("select * from st%s where id < 5" % curType)
|
||||||
|
tdSql.checkRows(40)
|
||||||
|
|
||||||
|
# <= for int type on tag
|
||||||
|
tdSql.query("select * from st%s where id <= 5" % curType)
|
||||||
|
tdSql.checkRows(50)
|
||||||
|
|
||||||
|
# <> for int type on tag
|
||||||
|
tdSql.query("select * from st%s where id <> 5" % curType)
|
||||||
|
tdSql.checkRows(92)
|
||||||
|
|
||||||
|
# != for int type on tag
|
||||||
|
tdSql.query("select * from st%s where id != 5" % curType)
|
||||||
|
tdSql.checkRows(92)
|
||||||
|
|
||||||
|
# != for int type on tag
|
||||||
|
tdSql.query("select * from st%s where id != 5" % curType)
|
||||||
|
tdSql.checkRows(92)
|
||||||
|
|
||||||
|
# range for int type on tag
|
||||||
|
tdSql.query("select * from st%s where id > 5 and id < 7" % curType)
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
|
||||||
|
tdSql.query(
|
||||||
|
"select * from st%s where id >= 5 and id < 7" %
|
||||||
|
curType)
|
||||||
|
tdSql.checkRows(20)
|
||||||
|
|
||||||
|
tdSql.query(
|
||||||
|
"select * from st%s where id > 5 and id <= 7" %
|
||||||
|
curType)
|
||||||
|
tdSql.checkRows(20)
|
||||||
|
|
||||||
|
tdSql.query(
|
||||||
|
"select * from st%s where id >= 5 and id <= 7" %
|
||||||
|
curType)
|
||||||
|
tdSql.checkRows(30)
|
||||||
|
|
||||||
|
print(
|
||||||
|
"======= Verify filter for %s type finished =========" %
|
||||||
|
curType)
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -25,7 +25,7 @@ class TDTestCase:
|
||||||
tdLog.debug("start to execute %s" % __file__)
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
tdSql.init(conn.cursor(), logSql)
|
tdSql.init(conn.cursor(), logSql)
|
||||||
|
|
||||||
self.types = ["tinyint", "smallint", "int", "bigint", "float", "double", "bool", "binary(10)", "nchar(10)"]
|
self.types = ["tinyint", "smallint", "int", "bigint", "float", "double", "bool", "binary(10)", "nchar(10)", "tinyint unsigned", "smallint unsigned", "int unsigned", "bigint unsigned"]
|
||||||
self.ts = 1537146000000
|
self.ts = 1537146000000
|
||||||
|
|
||||||
def checkNullValue(self, result):
|
def checkNullValue(self, result):
|
||||||
|
|
|
@ -73,19 +73,19 @@ class TDTestCase:
|
||||||
print("======= step 1: create table and insert data =========")
|
print("======= step 1: create table and insert data =========")
|
||||||
tdLog.debug(
|
tdLog.debug(
|
||||||
''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double,
|
''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double,
|
||||||
tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float,
|
tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20), tbcol11 tinyint unsigned, tbcol12 smallint unsigned, tbcol13 int unsigned, tbcol14 bigint unsigned) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float,
|
||||||
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))''')
|
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20), tagcol11 tinyint unsigned, tagcol12 smallint unsigned, tagcol13 int unsigned, tagcol14 bigint unsigned)''')
|
||||||
tdSql.execute(
|
tdSql.execute(
|
||||||
''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double,
|
''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double,
|
||||||
tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float,
|
tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20), tbcol11 tinyint unsigned, tbcol12 smallint unsigned, tbcol13 int unsigned, tbcol14 bigint unsigned) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float,
|
||||||
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))''')
|
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20), tagcol11 tinyint unsigned, tagcol12 smallint unsigned, tagcol13 int unsigned, tagcol14 bigint unsigned)''')
|
||||||
|
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("create table st%d using st tags(%d, %d, %d, %d, %f, %f, %d, 'tag%d', '标签%d')" % (
|
tdSql.execute("create table st%d using st tags(%d, %d, %d, %d, %f, %f, %d, 'tag%d', '标签%d', %d, %d, %d, %d)" % (
|
||||||
i + 1, i + 1, i + 1, i + 1, i + 1, 1.1 * (i + 1), 1.23 * (i + 1), (i + 1) % 2, i + 1, i + 1))
|
i + 1, i + 1, i + 1, i + 1, i + 1, 1.1 * (i + 1), 1.23 * (i + 1), (i + 1) % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
|
||||||
for j in range(self.rowNum):
|
for j in range(self.rowNum):
|
||||||
tdSql.execute("insert into st%d values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')" % (
|
tdSql.execute("insert into st%d values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" % (
|
||||||
i + 1, self.ts + 10 * (i + 1) + j + 1, j + 1, j + 1, j + 1, j + 1, 1.1 * (j + 1), 1.23 * (j + 1), (j + 1) % 2, j + 1, j + 1))
|
i + 1, self.ts + 10 * (i + 1) + j + 1, j + 1, j + 1, j + 1, j + 1, 1.1 * (j + 1), 1.23 * (j + 1), (j + 1) % 2, j + 1, j + 1, i + 1, i + 1, i + 1, i + 1))
|
||||||
|
|
||||||
print("======= step 2: verify order for each column =========")
|
print("======= step 2: verify order for each column =========")
|
||||||
# sort for timestamp in asc order
|
# sort for timestamp in asc order
|
||||||
|
|
|
@ -141,6 +141,98 @@ class TDTestCase:
|
||||||
# TSIM: sql select * from $mt where tgcol2 = 1 -x step2
|
# TSIM: sql select * from $mt where tgcol2 = 1 -x step2
|
||||||
tdLog.info('select * from %s where tgcol2 = 1 -x step2' % (mt))
|
tdLog.info('select * from %s where tgcol2 = 1 -x step2' % (mt))
|
||||||
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
|
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
|
||||||
|
tdLog.info('=============== step2-1')
|
||||||
|
# TSIM: $i = 2
|
||||||
|
i = 21
|
||||||
|
# TSIM: $mt = $mtPrefix . $i
|
||||||
|
mt = "%s%d" % (mtPrefix, i)
|
||||||
|
# TSIM: $tb = $tbPrefix . $i
|
||||||
|
tb = "%s%d" % (tbPrefix, i)
|
||||||
|
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
|
||||||
|
# bool, tgcol2 int)
|
||||||
|
tdLog.info(
|
||||||
|
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int unsigned)' %
|
||||||
|
(mt))
|
||||||
|
tdSql.execute(
|
||||||
|
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int unsigned)' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: sql create table $tb using $mt tags( 1, 2 )
|
||||||
|
tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
|
||||||
|
tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
|
||||||
|
# TSIM: sql insert into $tb values(now, 1)
|
||||||
|
tdLog.info('insert into %s values(now, 1)' % (tb))
|
||||||
|
tdSql.execute('insert into %s values(now, 1)' % (tb))
|
||||||
|
# TSIM: sql select * from $mt where tgcol2 = 2
|
||||||
|
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
|
||||||
|
# TSIM: if $rows != 1 then
|
||||||
|
tdLog.info('tdSql.checkRow(1)')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data01 != 1 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 1)')
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data02 != 1 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 2, 1)')
|
||||||
|
tdSql.checkData(0, 2, 1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data03 != 2 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 3, 2)')
|
||||||
|
tdSql.checkData(0, 3, 2)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sql alter table $mt drop tag tgcol2
|
||||||
|
tdLog.info('alter table %s drop tag tgcol2' % (mt))
|
||||||
|
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
|
||||||
|
# TSIM: sql alter table $mt add tag tgcol4 int
|
||||||
|
tdLog.info('alter table %s add tag tgcol4 int unsigned' % (mt))
|
||||||
|
tdSql.execute('alter table %s add tag tgcol4 int unsigned' % (mt))
|
||||||
|
tdLog.info('select * from %s where tgcol4=6' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol4=6' % (mt))
|
||||||
|
# TSIM: sql reset query cache
|
||||||
|
tdLog.info('reset query cache')
|
||||||
|
tdSql.execute('reset query cache')
|
||||||
|
# TSIM: sql alter table $tb set tag tgcol4 =4
|
||||||
|
tdLog.info('alter table %s set tag tgcol4 =4' % (tb))
|
||||||
|
tdSql.execute('alter table %s set tag tgcol4 =4' % (tb))
|
||||||
|
# TSIM: sql reset query cache
|
||||||
|
tdLog.info('reset query cache')
|
||||||
|
tdSql.execute('reset query cache')
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sql select * from $mt where tgcol4 = 4
|
||||||
|
tdLog.info('select * from %s where tgcol4 = 4' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol4 = 4' % (mt))
|
||||||
|
# TSIM: print $data01 $data02 $data03
|
||||||
|
tdLog.info('$data01 $data02 $data03')
|
||||||
|
# TSIM: if $rows != 1 then
|
||||||
|
tdLog.info('tdSql.checkRow(1)')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data01 != 1 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 1)')
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data02 != 1 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 2, 1)')
|
||||||
|
tdSql.checkData(0, 2, 1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data03 != 4 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 3, 4)')
|
||||||
|
tdSql.checkData(0, 3, 4)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sql select * from $mt where tgcol2 = 1 -x step2
|
||||||
|
tdLog.info('select * from %s where tgcol2 = 1 -x step2' % (mt))
|
||||||
|
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
|
||||||
# TSIM: return -1
|
# TSIM: return -1
|
||||||
# TSIM: step2:
|
# TSIM: step2:
|
||||||
# TSIM:
|
# TSIM:
|
||||||
|
@ -235,6 +327,96 @@ class TDTestCase:
|
||||||
# TSIM: sql select * from $mt where tgcol2 = 1 -x step3
|
# TSIM: sql select * from $mt where tgcol2 = 1 -x step3
|
||||||
tdLog.info('select * from %s where tgcol2 = 1 -x step3' % (mt))
|
tdLog.info('select * from %s where tgcol2 = 1 -x step3' % (mt))
|
||||||
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
|
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
|
||||||
|
tdLog.info('=============== step3-1')
|
||||||
|
# TSIM: $i = 3
|
||||||
|
i = 31
|
||||||
|
# TSIM: $mt = $mtPrefix . $i
|
||||||
|
mt = "%s%d" % (mtPrefix, i)
|
||||||
|
# TSIM: $tb = $tbPrefix . $i
|
||||||
|
tb = "%s%d" % (tbPrefix, i)
|
||||||
|
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
|
||||||
|
# smallint, tgcol2 tinyint)
|
||||||
|
tdLog.info(
|
||||||
|
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint unsigned, tgcol2 tinyint unsigned)' %
|
||||||
|
(mt))
|
||||||
|
tdSql.execute(
|
||||||
|
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint unsigned, tgcol2 tinyint unsigned)' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: sql create table $tb using $mt tags( 1, 2 )
|
||||||
|
tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
|
||||||
|
tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
|
||||||
|
# TSIM: sql insert into $tb values(now, 1)
|
||||||
|
tdLog.info('insert into %s values(now, 1)' % (tb))
|
||||||
|
tdSql.execute('insert into %s values(now, 1)' % (tb))
|
||||||
|
# TSIM: sql select * from $mt where tgcol2 = 2
|
||||||
|
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
|
||||||
|
# TSIM: if $rows != 1 then
|
||||||
|
tdLog.info('tdSql.checkRow(1)')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data01 != 1 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 1)')
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data02 != 1 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 2, 1)')
|
||||||
|
tdSql.checkData(0, 2, 1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data03 != 2 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 3, 2)')
|
||||||
|
tdSql.checkData(0, 3, 2)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sql alter table $mt drop tag tgcol2
|
||||||
|
tdLog.info('alter table %s drop tag tgcol2' % (mt))
|
||||||
|
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
|
||||||
|
# TSIM: sql alter table $mt add tag tgcol4 tinyint
|
||||||
|
tdLog.info('alter table %s add tag tgcol4 tinyint unsigned' % (mt))
|
||||||
|
tdSql.execute('alter table %s add tag tgcol4 tinyint unsigned' % (mt))
|
||||||
|
# TSIM: sql reset query cache
|
||||||
|
tdLog.info('reset query cache')
|
||||||
|
tdSql.execute('reset query cache')
|
||||||
|
# TSIM: sql alter table $tb set tag tgcol4=4
|
||||||
|
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
|
||||||
|
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
|
||||||
|
# TSIM: sql reset query cache
|
||||||
|
tdLog.info('reset query cache')
|
||||||
|
tdSql.execute('reset query cache')
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sql select * from $mt where tgcol4 = 4
|
||||||
|
tdLog.info('select * from %s where tgcol4 = 4' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol4 = 4' % (mt))
|
||||||
|
# TSIM: print $data01 $data02 $data03
|
||||||
|
tdLog.info('$data01 $data02 $data03')
|
||||||
|
# TSIM: if $rows != 1 then
|
||||||
|
tdLog.info('tdSql.checkRow(1)')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data01 != 1 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 1)')
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data02 != 1 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 2, 1)')
|
||||||
|
tdSql.checkData(0, 2, 1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data03 != 4 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 3, 4)')
|
||||||
|
tdSql.checkData(0, 3, 4)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sql select * from $mt where tgcol2 = 1 -x step3
|
||||||
|
tdLog.info('select * from %s where tgcol2 = 1 -x step3' % (mt))
|
||||||
|
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
|
||||||
# TSIM: return -1
|
# TSIM: return -1
|
||||||
# TSIM: step3:
|
# TSIM: step3:
|
||||||
# TSIM:
|
# TSIM:
|
||||||
|
@ -353,6 +535,120 @@ class TDTestCase:
|
||||||
# TSIM: sql select * from $mt where tgcol2 = 1 -x step4
|
# TSIM: sql select * from $mt where tgcol2 = 1 -x step4
|
||||||
tdLog.info('select * from %s where tgcol2 = 1 -x step4' % (mt))
|
tdLog.info('select * from %s where tgcol2 = 1 -x step4' % (mt))
|
||||||
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
|
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
|
||||||
|
tdLog.info('=============== step4-1')
|
||||||
|
# TSIM: $i = 4
|
||||||
|
i = 41
|
||||||
|
# TSIM: $mt = $mtPrefix . $i
|
||||||
|
mt = "%s%d" % (mtPrefix, i)
|
||||||
|
# TSIM: $tb = $tbPrefix . $i
|
||||||
|
tb = "%s%d" % (tbPrefix, i)
|
||||||
|
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
|
||||||
|
# bigint, tgcol2 float)
|
||||||
|
tdLog.info(
|
||||||
|
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint unsigned, tgcol2 float)' %
|
||||||
|
(mt))
|
||||||
|
tdSql.execute(
|
||||||
|
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint unsigned, tgcol2 float)' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: sql create table $tb using $mt tags( 1, 2 )
|
||||||
|
tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
|
||||||
|
tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
|
||||||
|
# TSIM: sql insert into $tb values(now, 1)
|
||||||
|
tdLog.info('insert into %s values(now, 1)' % (tb))
|
||||||
|
tdSql.execute('insert into %s values(now, 1)' % (tb))
|
||||||
|
# TSIM: sql select * from $mt where tgcol2 = 2
|
||||||
|
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
|
||||||
|
# TSIM: if $rows != 1 then
|
||||||
|
tdLog.info('tdSql.checkRow(1)')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data01 != 1 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 1)')
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data02 != 1 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 2, 1)')
|
||||||
|
tdSql.checkData(0, 2, 1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data03 != 2.00000 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 3, 2.00000)')
|
||||||
|
tdSql.checkData(0, 3, 2.00000)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sql describe $tb
|
||||||
|
tdLog.info('describe %s' % (tb))
|
||||||
|
tdSql.query('describe %s' % (tb))
|
||||||
|
# TSIM: if $data21 != BIGINT then
|
||||||
|
tdLog.info('tdSql.checkDataType(2, 1, "BIGINT UNSIGNED")')
|
||||||
|
tdSql.checkDataType(2, 1, "BIGINT")
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data31 != FLOAT then
|
||||||
|
tdLog.info('tdSql.checkDataType(3, 1, "FLOAT")')
|
||||||
|
tdSql.checkDataType(3, 1, "FLOAT")
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data23 != 1 then
|
||||||
|
tdLog.info('tdSql.checkData(2, 3, TAG)')
|
||||||
|
tdSql.checkData(2, 3, "TAG")
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data33 != 2.000000 then
|
||||||
|
tdLog.info('tdSql.checkData(3, 3, 2.000000)')
|
||||||
|
tdSql.checkData(3, 3, "TAG")
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sql alter table $mt drop tag tgcol2
|
||||||
|
tdLog.info('alter table %s drop tag tgcol2' % (mt))
|
||||||
|
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
|
||||||
|
# TSIM: sql alter table $mt add tag tgcol4 float
|
||||||
|
tdLog.info('alter table %s add tag tgcol4 float' % (mt))
|
||||||
|
tdSql.execute('alter table %s add tag tgcol4 float' % (mt))
|
||||||
|
# TSIM: sql reset query cache
|
||||||
|
tdLog.info('reset query cache')
|
||||||
|
tdSql.execute('reset query cache')
|
||||||
|
# TSIM: sql alter table $tb set tag tgcol4=4
|
||||||
|
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
|
||||||
|
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
|
||||||
|
# TSIM: sql reset query cache
|
||||||
|
tdLog.info('reset query cache')
|
||||||
|
tdSql.execute('reset query cache')
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sql select * from $mt where tgcol4 = 4
|
||||||
|
tdLog.info('select * from %s where tgcol4 = 4' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol4 = 4' % (mt))
|
||||||
|
# TSIM: print $data01 $data02 $data03
|
||||||
|
tdLog.info('$data01 $data02 $data03')
|
||||||
|
# TSIM: if $rows != 1 then
|
||||||
|
tdLog.info('tdSql.checkRow(1)')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data01 != 1 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 1)')
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data02 != 1 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 2, 1)')
|
||||||
|
tdSql.checkData(0, 2, 1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data03 != 4.00000 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 3, 4.00000)')
|
||||||
|
tdSql.checkData(0, 3, 4.00000)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sql select * from $mt where tgcol2 = 1 -x step4
|
||||||
|
tdLog.info('select * from %s where tgcol2 = 1 -x step4' % (mt))
|
||||||
|
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
|
||||||
# TSIM: return -1
|
# TSIM: return -1
|
||||||
# TSIM: step4:
|
# TSIM: step4:
|
||||||
# TSIM:
|
# TSIM:
|
||||||
|
@ -408,12 +704,18 @@ class TDTestCase:
|
||||||
# TSIM: sql alter table $mt add tag tgcol4 smallint
|
# TSIM: sql alter table $mt add tag tgcol4 smallint
|
||||||
tdLog.info('alter table %s add tag tgcol4 smallint' % (mt))
|
tdLog.info('alter table %s add tag tgcol4 smallint' % (mt))
|
||||||
tdSql.execute('alter table %s add tag tgcol4 smallint' % (mt))
|
tdSql.execute('alter table %s add tag tgcol4 smallint' % (mt))
|
||||||
|
# TSIM: sql alter table $mt add tag tgcol5 smallint unsigned
|
||||||
|
tdLog.info('alter table %s add tag tgcol5 smallint unsigned' % (mt))
|
||||||
|
tdSql.execute('alter table %s add tag tgcol5 smallint unsigned' % (mt))
|
||||||
# TSIM: sql reset query cache
|
# TSIM: sql reset query cache
|
||||||
tdLog.info('reset query cache')
|
tdLog.info('reset query cache')
|
||||||
tdSql.execute('reset query cache')
|
tdSql.execute('reset query cache')
|
||||||
# TSIM: sql alter table $tb set tag tgcol4=4
|
# TSIM: sql alter table $tb set tag tgcol4=4
|
||||||
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
|
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
|
||||||
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
|
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
|
||||||
|
# TSIM: sql alter table $tb set tag tgcol5=5
|
||||||
|
tdLog.info('alter table %s set tag tgcol5=5' % (tb))
|
||||||
|
tdSql.execute('alter table %s set tag tgcol5=5' % (tb))
|
||||||
# TSIM: sql reset query cache
|
# TSIM: sql reset query cache
|
||||||
tdLog.info('reset query cache')
|
tdLog.info('reset query cache')
|
||||||
tdSql.execute('reset query cache')
|
tdSql.execute('reset query cache')
|
||||||
|
@ -441,6 +743,11 @@ class TDTestCase:
|
||||||
# TSIM: if $data03 != 4 then
|
# TSIM: if $data03 != 4 then
|
||||||
tdLog.info('tdSql.checkData(0, 3, 4)')
|
tdLog.info('tdSql.checkData(0, 3, 4)')
|
||||||
tdSql.checkData(0, 3, 4)
|
tdSql.checkData(0, 3, 4)
|
||||||
|
tdSql.query('select * from %s where tgcol5 = 5' % (mt))
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
tdSql.checkData(0, 2, 1.000000000)
|
||||||
|
tdSql.checkData(0, 4, 5)
|
||||||
# TSIM: return -1
|
# TSIM: return -1
|
||||||
# TSIM: endi
|
# TSIM: endi
|
||||||
# TSIM:
|
# TSIM:
|
||||||
|
|
|
@ -869,6 +869,91 @@ class TDTestCase:
|
||||||
# TSIM: sql alter table $mt drop tag tgcol6
|
# TSIM: sql alter table $mt drop tag tgcol6
|
||||||
tdLog.info('alter table %s drop tag tgcol6' % (mt))
|
tdLog.info('alter table %s drop tag tgcol6' % (mt))
|
||||||
tdSql.execute('alter table %s drop tag tgcol6' % (mt))
|
tdSql.execute('alter table %s drop tag tgcol6' % (mt))
|
||||||
|
tdLog.info('=============== step14')
|
||||||
|
# TSIM: $i = 14
|
||||||
|
i = 14
|
||||||
|
# TSIM: $mt = $mtPrefix . $i
|
||||||
|
mt = "%s%d" % (mtPrefix, i)
|
||||||
|
# TSIM: $tb = $tbPrefix . $i
|
||||||
|
tb = "%s%d" % (tbPrefix, i)
|
||||||
|
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
|
||||||
|
# binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5
|
||||||
|
# double, tgcol6 binary(20))
|
||||||
|
tdLog.info(
|
||||||
|
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int unsigned, tgcol3 smallint unsigned, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20), tgcol7 tinyint unsigned, tgcol8 bigint unsigned)' %
|
||||||
|
(mt))
|
||||||
|
tdSql.execute(
|
||||||
|
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int unsigned, tgcol3 smallint unsigned, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20), tgcol7 tinyint unsigned, tgcol8 bigint unsigned)' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' )
|
||||||
|
tdLog.info(
|
||||||
|
'create table %s using %s tags( "1", 2, 3, "4", 5, "6", 7, 8 )' %
|
||||||
|
(tb, mt))
|
||||||
|
tdSql.execute(
|
||||||
|
'create table %s using %s tags( "1", 2, 3, "4", 5, "6", 7, 8 )' %
|
||||||
|
(tb, mt))
|
||||||
|
# TSIM: sql insert into $tb values(now, 1)
|
||||||
|
tdLog.info('insert into %s values(now, 1)' % (tb))
|
||||||
|
tdSql.execute('insert into %s values(now, 1)' % (tb))
|
||||||
|
# TSIM: sql select * from $mt where tgcol1 = '1'
|
||||||
|
tdLog.info('select * from %s where tgcol1 = "1"' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol1 = "1"' % (mt))
|
||||||
|
# TSIM: if $rows != 1 then
|
||||||
|
tdLog.info('tdSql.checkRow(1)')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data01 != 1 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 1)')
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data02 != 1 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 2, "1")')
|
||||||
|
tdSql.checkData(0, 2, "1")
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data03 != 2 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 3, 2)')
|
||||||
|
tdSql.checkData(0, 3, 2)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data04 != 3 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 4, 3)')
|
||||||
|
tdSql.checkData(0, 4, 3)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data05 != 4 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 5, "4")')
|
||||||
|
tdSql.checkData(0, 5, "4")
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data06 != 5.000000000 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 6, 5.000000000)')
|
||||||
|
tdSql.checkData(0, 6, 5.000000000)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: if $data07 != 6 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 7, "6")')
|
||||||
|
tdSql.checkData(0, 7, "6")
|
||||||
|
tdLog.info('tdSql.checkData(0, 8, 7)')
|
||||||
|
tdSql.checkData(0, 8, 7)
|
||||||
|
tdLog.info('tdSql.checkData(0, 9, 8)')
|
||||||
|
tdSql.checkData(0, 9, 8)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sql alter table $mt drop tag tgcol3
|
||||||
|
tdLog.info('alter table %s drop tag tgcol3' % (mt))
|
||||||
|
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
|
||||||
|
# TSIM: sql alter table $mt drop tag tgcol4
|
||||||
|
tdLog.info('alter table %s drop tag tgcol4' % (mt))
|
||||||
|
tdSql.execute('alter table %s drop tag tgcol4' % (mt))
|
||||||
|
# TSIM: sql alter table $mt drop tag tgcol6
|
||||||
|
tdLog.info('alter table %s drop tag tgcol6' % (mt))
|
||||||
|
tdSql.execute('alter table %s drop tag tgcol6' % (mt))
|
||||||
|
tdLog.info('alter table %s drop tag tgcol8' % (mt))
|
||||||
|
tdSql.execute('alter table %s drop tag tgcol8' % (mt))
|
||||||
# TSIM:
|
# TSIM:
|
||||||
# TSIM: sleep 5000
|
# TSIM: sleep 5000
|
||||||
# TSIM:
|
# TSIM:
|
||||||
|
@ -1556,7 +1641,7 @@ class TDTestCase:
|
||||||
# TSIM: print =============== step14
|
# TSIM: print =============== step14
|
||||||
tdLog.info('=============== step14')
|
tdLog.info('=============== step14')
|
||||||
# TSIM: $i = 14
|
# TSIM: $i = 14
|
||||||
i = 14
|
i = 20
|
||||||
# TSIM: $mt = $mtPrefix . $i
|
# TSIM: $mt = $mtPrefix . $i
|
||||||
mt = "%s%d" % (mtPrefix, i)
|
mt = "%s%d" % (mtPrefix, i)
|
||||||
# TSIM: $tb = $tbPrefix . $i
|
# TSIM: $tb = $tbPrefix . $i
|
||||||
|
|
|
@ -0,0 +1,602 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
|
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(), logSql)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
# TSIM: system sh/stop_dnodes.sh
|
||||||
|
# TSIM:
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
# TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0
|
||||||
|
# TSIM: system sh/exec.sh -n dnode1 -s start
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sleep 3000
|
||||||
|
# TSIM: sql connect
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print ======================== dnode1 start
|
||||||
|
tdLog.info('======================== dnode1 start')
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: $dbPrefix = ta_sm_db
|
||||||
|
# TSIM: $tbPrefix = ta_sm_tb
|
||||||
|
tbPrefix = "ta_sm_tb"
|
||||||
|
# TSIM: $mtPrefix = ta_sm_mt
|
||||||
|
mtPrefix = "ta_sm_mt"
|
||||||
|
# TSIM: $tbNum = 10
|
||||||
|
tbNum = 10
|
||||||
|
# TSIM: $rowNum = 20
|
||||||
|
rowNum = 20
|
||||||
|
# TSIM: $totalNum = 200
|
||||||
|
totalNum = 200
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step1
|
||||||
|
tdLog.info('=============== step1')
|
||||||
|
# TSIM: $i = 0
|
||||||
|
i = 0
|
||||||
|
# TSIM: $db = $dbPrefix . $i
|
||||||
|
# TSIM: $mt = $mtPrefix . $i
|
||||||
|
mt = "%s%d" % (mtPrefix, i)
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sql create database $db
|
||||||
|
# TSIM: sql use $db
|
||||||
|
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol
|
||||||
|
# bigint unsigned)
|
||||||
|
tdLog.info(
|
||||||
|
'create table %s (ts timestamp, tbcol int) TAGS(tgcol bigint unsigned)' %
|
||||||
|
(mt))
|
||||||
|
tdSql.execute(
|
||||||
|
'create table %s (ts timestamp, tbcol int) TAGS(tgcol bigint unsigned)' %
|
||||||
|
(mt))
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: $i = 0
|
||||||
|
i = 0
|
||||||
|
# TSIM: while $i < 5
|
||||||
|
while (i < 5):
|
||||||
|
# TSIM: $tb = $tbPrefix . $i
|
||||||
|
tb = "%s%d" % (tbPrefix, i)
|
||||||
|
# TSIM: sql create table $tb using $mt tags( 0 )
|
||||||
|
tdLog.info('create table %s using %s tags( 0 )' % (tb, mt))
|
||||||
|
tdSql.execute('create table %s using %s tags( 0 )' % (tb, mt))
|
||||||
|
# TSIM: $x = 0
|
||||||
|
x = 0
|
||||||
|
# TSIM: while $x < $rowNum
|
||||||
|
while (x < rowNum):
|
||||||
|
# TSIM: $ms = $x . m
|
||||||
|
ms = "%dm" % x
|
||||||
|
# TSIM: sql insert into $tb values (now + $ms , $x )
|
||||||
|
tdLog.info(
|
||||||
|
'insert into %s values (now + %s , %d )' %
|
||||||
|
(tb, ms, x))
|
||||||
|
tdSql.execute(
|
||||||
|
'insert into %s values (now + %s , %d )' %
|
||||||
|
(tb, ms, x))
|
||||||
|
# TSIM: $x = $x + 1
|
||||||
|
x = x + 1
|
||||||
|
# TSIM: endw
|
||||||
|
# TSIM: $i = $i + 1
|
||||||
|
i = i + 1
|
||||||
|
# TSIM: endw
|
||||||
|
# TSIM: while $i < 10
|
||||||
|
while (i < 10):
|
||||||
|
# TSIM: $tb = $tbPrefix . $i
|
||||||
|
tb = "%s%d" % (tbPrefix, i)
|
||||||
|
# TSIM: sql create table $tb using $mt tags( 1 )
|
||||||
|
tdLog.info('create table %s using %s tags( 1 )' % (tb, mt))
|
||||||
|
tdSql.execute('create table %s using %s tags( 1 )' % (tb, mt))
|
||||||
|
# TSIM: $x = 0
|
||||||
|
x = 0
|
||||||
|
# TSIM: while $x < $rowNum
|
||||||
|
while (x < rowNum):
|
||||||
|
# TSIM: $ms = $x . m
|
||||||
|
ms = "%dm" % x
|
||||||
|
# TSIM: sql insert into $tb values (now + $ms , $x )
|
||||||
|
tdLog.info(
|
||||||
|
'insert into %s values (now + %s , %d )' %
|
||||||
|
(tb, ms, x))
|
||||||
|
tdSql.execute(
|
||||||
|
'insert into %s values (now + %s , %d )' %
|
||||||
|
(tb, ms, x))
|
||||||
|
# TSIM: $x = $x + 1
|
||||||
|
x = x + 1
|
||||||
|
# TSIM: endw
|
||||||
|
# TSIM: $i = $i + 1
|
||||||
|
i = i + 1
|
||||||
|
# TSIM: endw
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step2
|
||||||
|
tdLog.info('=============== step2')
|
||||||
|
# TSIM: sleep 100
|
||||||
|
# TSIM: sql select * from $tb
|
||||||
|
tdLog.info('select * from %s' % (tb))
|
||||||
|
tdSql.query('select * from %s' % (tb))
|
||||||
|
# TSIM: if $rows != $rowNum then
|
||||||
|
tdLog.info('tdSql.checkRow($rowNum)')
|
||||||
|
tdSql.checkRows(rowNum)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts < now + 4m
|
||||||
|
tdLog.info('select * from %s where ts < now + 4m' % (tb))
|
||||||
|
tdSql.query('select * from %s where ts < now + 4m' % (tb))
|
||||||
|
# TSIM: if $rows != 5 then
|
||||||
|
tdLog.info('tdSql.checkRow(5)')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts <= now + 4m
|
||||||
|
tdLog.info('select * from %s where ts <= now + 4m' % (tb))
|
||||||
|
tdSql.query('select * from %s where ts <= now + 4m' % (tb))
|
||||||
|
# TSIM: if $rows != 5 then
|
||||||
|
tdLog.info('tdSql.checkRow(5)')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > now + 4m
|
||||||
|
tdLog.info('select * from %s where ts > now + 4m' % (tb))
|
||||||
|
tdSql.query('select * from %s where ts > now + 4m' % (tb))
|
||||||
|
# TSIM: if $rows != 15 then
|
||||||
|
tdLog.info('tdSql.checkRow(15)')
|
||||||
|
tdSql.checkRows(15)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts >= now + 4m
|
||||||
|
tdLog.info('select * from %s where ts >= now + 4m' % (tb))
|
||||||
|
tdSql.query('select * from %s where ts >= now + 4m' % (tb))
|
||||||
|
# TSIM: if $rows != 15 then
|
||||||
|
tdLog.info('tdSql.checkRow(15)')
|
||||||
|
tdSql.checkRows(15)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m' %
|
||||||
|
(tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 1 then
|
||||||
|
tdLog.info('tdSql.checkRow(1)')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts < now + 4m and ts > now + 5m' %
|
||||||
|
(tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts < now + 4m and ts > now + 5m' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > 100000 and ts < 100000
|
||||||
|
tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > 100000 and ts < 100000' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 3m' %
|
||||||
|
(tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 3m' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and
|
||||||
|
# ts < now + 6m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
|
||||||
|
(tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 1 then
|
||||||
|
tdLog.info('tdSql.checkRow(1)')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step3
|
||||||
|
tdLog.info('=============== step3')
|
||||||
|
# TSIM: sql select * from $mt
|
||||||
|
tdLog.info('select * from %s' % (mt))
|
||||||
|
tdSql.query('select * from %s' % (mt))
|
||||||
|
# TSIM: if $rows != $totalNum then
|
||||||
|
tdLog.info('tdSql.checkRow($totalNum)')
|
||||||
|
tdSql.checkRows(totalNum)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sql select * from $mt where ts < now + 4m
|
||||||
|
tdLog.info('select * from %s where ts < now + 4m' % (mt))
|
||||||
|
tdSql.query('select * from %s where ts < now + 4m' % (mt))
|
||||||
|
# TSIM: if $rows != 50 then
|
||||||
|
tdLog.info('tdSql.checkRow(50)')
|
||||||
|
tdSql.checkRows(50)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m
|
||||||
|
tdLog.info('select * from %s where ts > now + 4m' % (mt))
|
||||||
|
tdSql.query('select * from %s where ts > now + 4m' % (mt))
|
||||||
|
# TSIM: if $rows != 150 then
|
||||||
|
tdLog.info('tdSql.checkRow(150)')
|
||||||
|
tdSql.checkRows(150)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts = now + 4m
|
||||||
|
tdLog.info('select * from %s where ts = now + 4m' % (mt))
|
||||||
|
tdSql.query('select * from %s where ts = now + 4m' % (mt))
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 10 then
|
||||||
|
tdLog.info('tdSql.checkRow(10)')
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step4
|
||||||
|
tdLog.info('=============== step4')
|
||||||
|
# TSIM: sql select * from $mt where tgcol = 0
|
||||||
|
tdLog.info('select * from %s where tgcol = 0' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol = 0' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol <> 0
|
||||||
|
tdLog.info('select * from %s where tgcol <> 0' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol <> 0' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol = 1
|
||||||
|
tdLog.info('select * from %s where tgcol = 1' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol = 1' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol <> 1
|
||||||
|
tdLog.info('select * from %s where tgcol <> 1' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol <> 1' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol = 1
|
||||||
|
tdLog.info('select * from %s where tgcol = 1' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol = 1' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol <> 1
|
||||||
|
tdLog.info('select * from %s where tgcol <> 1' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol <> 1' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol = 0
|
||||||
|
tdLog.info('select * from %s where tgcol = 0' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol = 0' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol <> 0
|
||||||
|
tdLog.info('select * from %s where tgcol <> 0' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol <> 0' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step5
|
||||||
|
tdLog.info('=============== step5')
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1
|
||||||
|
tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol = 1' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 75 then
|
||||||
|
tdLog.info('tdSql.checkRow(75)')
|
||||||
|
tdSql.checkRows(75)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol <> 1' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol <> 1' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 75 then
|
||||||
|
tdLog.info('tdSql.checkRow(75)')
|
||||||
|
tdSql.checkRows(75)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0
|
||||||
|
tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts < now + 4m and tgcol = 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 25 then
|
||||||
|
tdLog.info('tdSql.checkRow(25)')
|
||||||
|
tdSql.checkRows(25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts < now + 4m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts < now + 4m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 25 then
|
||||||
|
tdLog.info('tdSql.checkRow(25)')
|
||||||
|
tdSql.checkRows(25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts <= now + 4m and tgcol = 0' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts <= now + 4m and tgcol = 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 25 then
|
||||||
|
tdLog.info('tdSql.checkRow(25)')
|
||||||
|
tdSql.checkRows(25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts <= now + 4m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts <= now + 4m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 25 then
|
||||||
|
tdLog.info('tdSql.checkRow(25)')
|
||||||
|
tdSql.checkRows(25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
|
||||||
|
# tgcol <> 0
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 5 then
|
||||||
|
tdLog.info('tdSql.checkRow(5)')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts
|
||||||
|
# < now + 5m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 5 then
|
||||||
|
tdLog.info('tdSql.checkRow(5)')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step6
|
||||||
|
tdLog.info('=============== step6')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 200 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 200)')
|
||||||
|
tdSql.checkData(0, 0, 200)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step7
|
||||||
|
tdLog.info('=============== step7')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 100 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 100)')
|
||||||
|
tdSql.checkData(0, 0, 100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step8
|
||||||
|
tdLog.info('=============== step8')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 50 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 50)')
|
||||||
|
tdSql.checkData(0, 0, 50)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step9
|
||||||
|
tdLog.info('=============== step9')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 100 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 100)')
|
||||||
|
tdSql.checkData(0, 0, 100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step10
|
||||||
|
tdLog.info('=============== step10')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group
|
||||||
|
# by tgcol
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 100 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 100)')
|
||||||
|
tdSql.checkData(0, 0, 100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step11
|
||||||
|
tdLog.info('=============== step11')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
|
||||||
|
# group by tgcol
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 25 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 25)')
|
||||||
|
tdSql.checkData(0, 0, 25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step12
|
||||||
|
tdLog.info('=============== step12')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by
|
||||||
|
# tgcol
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data01 != 100 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 100)')
|
||||||
|
tdSql.checkData(0, 1, 100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== clear
|
||||||
|
tdLog.info('=============== clear')
|
||||||
|
# TSIM: sql drop database $db
|
||||||
|
tdLog.info('drop database db')
|
||||||
|
tdSql.execute('drop database db')
|
||||||
|
# TSIM: sql show databases
|
||||||
|
tdLog.info('show databases')
|
||||||
|
tdSql.query('show databases')
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
# convert end
|
||||||
|
tdSql.execute("create database db")
|
||||||
|
tdSql.execute("use db")
|
||||||
|
tdSql.execute(
|
||||||
|
"create table if not exists st (ts timestamp, tagtype int) tags(dev bigint unsigned)")
|
||||||
|
tdSql.error(
|
||||||
|
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (pow(2, 64) - 1))
|
||||||
|
tdSql.error(
|
||||||
|
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (-1))
|
||||||
|
|
||||||
|
tdSql.execute(
|
||||||
|
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (pow(2, 64) - 2))
|
||||||
|
tdSql.execute(
|
||||||
|
'CREATE TABLE if not exists dev_002 using st tags(%d)' % (0))
|
||||||
|
tdSql.execute(
|
||||||
|
'CREATE TABLE if not exists dev_003 using st tags(%s)' % ('NULL'))
|
||||||
|
print("==============step2")
|
||||||
|
tdSql.query("show tables")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -0,0 +1,602 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
|
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(), logSql)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
# TSIM: system sh/stop_dnodes.sh
|
||||||
|
# TSIM:
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
# TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0
|
||||||
|
# TSIM: system sh/exec.sh -n dnode1 -s start
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sleep 3000
|
||||||
|
# TSIM: sql connect
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print ======================== dnode1 start
|
||||||
|
tdLog.info('======================== dnode1 start')
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: $dbPrefix = ta_sm_db
|
||||||
|
# TSIM: $tbPrefix = ta_sm_tb
|
||||||
|
tbPrefix = "ta_sm_tb"
|
||||||
|
# TSIM: $mtPrefix = ta_sm_mt
|
||||||
|
mtPrefix = "ta_sm_mt"
|
||||||
|
# TSIM: $tbNum = 10
|
||||||
|
tbNum = 10
|
||||||
|
# TSIM: $rowNum = 20
|
||||||
|
rowNum = 20
|
||||||
|
# TSIM: $totalNum = 200
|
||||||
|
totalNum = 200
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step1
|
||||||
|
tdLog.info('=============== step1')
|
||||||
|
# TSIM: $i = 0
|
||||||
|
i = 0
|
||||||
|
# TSIM: $db = $dbPrefix . $i
|
||||||
|
# TSIM: $mt = $mtPrefix . $i
|
||||||
|
mt = "%s%d" % (mtPrefix, i)
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sql create database $db
|
||||||
|
# TSIM: sql use $db
|
||||||
|
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol
|
||||||
|
# int unsigned)
|
||||||
|
tdLog.info(
|
||||||
|
'create table %s (ts timestamp, tbcol int) TAGS(tgcol int unsigned)' %
|
||||||
|
(mt))
|
||||||
|
tdSql.execute(
|
||||||
|
'create table %s (ts timestamp, tbcol int) TAGS(tgcol int unsigned)' %
|
||||||
|
(mt))
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: $i = 0
|
||||||
|
i = 0
|
||||||
|
# TSIM: while $i < 5
|
||||||
|
while (i < 5):
|
||||||
|
# TSIM: $tb = $tbPrefix . $i
|
||||||
|
tb = "%s%d" % (tbPrefix, i)
|
||||||
|
# TSIM: sql create table $tb using $mt tags( 0 )
|
||||||
|
tdLog.info('create table %s using %s tags( 0 )' % (tb, mt))
|
||||||
|
tdSql.execute('create table %s using %s tags( 0 )' % (tb, mt))
|
||||||
|
# TSIM: $x = 0
|
||||||
|
x = 0
|
||||||
|
# TSIM: while $x < $rowNum
|
||||||
|
while (x < rowNum):
|
||||||
|
# TSIM: $ms = $x . m
|
||||||
|
ms = "%dm" % x
|
||||||
|
# TSIM: sql insert into $tb values (now + $ms , $x )
|
||||||
|
tdLog.info(
|
||||||
|
'insert into %s values (now + %s , %d )' %
|
||||||
|
(tb, ms, x))
|
||||||
|
tdSql.execute(
|
||||||
|
'insert into %s values (now + %s , %d )' %
|
||||||
|
(tb, ms, x))
|
||||||
|
# TSIM: $x = $x + 1
|
||||||
|
x = x + 1
|
||||||
|
# TSIM: endw
|
||||||
|
# TSIM: $i = $i + 1
|
||||||
|
i = i + 1
|
||||||
|
# TSIM: endw
|
||||||
|
# TSIM: while $i < 10
|
||||||
|
while (i < 10):
|
||||||
|
# TSIM: $tb = $tbPrefix . $i
|
||||||
|
tb = "%s%d" % (tbPrefix, i)
|
||||||
|
# TSIM: sql create table $tb using $mt tags( 1 )
|
||||||
|
tdLog.info('create table %s using %s tags( 1 )' % (tb, mt))
|
||||||
|
tdSql.execute('create table %s using %s tags( 1 )' % (tb, mt))
|
||||||
|
# TSIM: $x = 0
|
||||||
|
x = 0
|
||||||
|
# TSIM: while $x < $rowNum
|
||||||
|
while (x < rowNum):
|
||||||
|
# TSIM: $ms = $x . m
|
||||||
|
ms = "%dm" % x
|
||||||
|
# TSIM: sql insert into $tb values (now + $ms , $x )
|
||||||
|
tdLog.info(
|
||||||
|
'insert into %s values (now + %s , %d )' %
|
||||||
|
(tb, ms, x))
|
||||||
|
tdSql.execute(
|
||||||
|
'insert into %s values (now + %s , %d )' %
|
||||||
|
(tb, ms, x))
|
||||||
|
# TSIM: $x = $x + 1
|
||||||
|
x = x + 1
|
||||||
|
# TSIM: endw
|
||||||
|
# TSIM: $i = $i + 1
|
||||||
|
i = i + 1
|
||||||
|
# TSIM: endw
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step2
|
||||||
|
tdLog.info('=============== step2')
|
||||||
|
# TSIM: sleep 100
|
||||||
|
# TSIM: sql select * from $tb
|
||||||
|
tdLog.info('select * from %s' % (tb))
|
||||||
|
tdSql.query('select * from %s' % (tb))
|
||||||
|
# TSIM: if $rows != $rowNum then
|
||||||
|
tdLog.info('tdSql.checkRow($rowNum)')
|
||||||
|
tdSql.checkRows(rowNum)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts < now + 4m
|
||||||
|
tdLog.info('select * from %s where ts < now + 4m' % (tb))
|
||||||
|
tdSql.query('select * from %s where ts < now + 4m' % (tb))
|
||||||
|
# TSIM: if $rows != 5 then
|
||||||
|
tdLog.info('tdSql.checkRow(5)')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts <= now + 4m
|
||||||
|
tdLog.info('select * from %s where ts <= now + 4m' % (tb))
|
||||||
|
tdSql.query('select * from %s where ts <= now + 4m' % (tb))
|
||||||
|
# TSIM: if $rows != 5 then
|
||||||
|
tdLog.info('tdSql.checkRow(5)')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > now + 4m
|
||||||
|
tdLog.info('select * from %s where ts > now + 4m' % (tb))
|
||||||
|
tdSql.query('select * from %s where ts > now + 4m' % (tb))
|
||||||
|
# TSIM: if $rows != 15 then
|
||||||
|
tdLog.info('tdSql.checkRow(15)')
|
||||||
|
tdSql.checkRows(15)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts >= now + 4m
|
||||||
|
tdLog.info('select * from %s where ts >= now + 4m' % (tb))
|
||||||
|
tdSql.query('select * from %s where ts >= now + 4m' % (tb))
|
||||||
|
# TSIM: if $rows != 15 then
|
||||||
|
tdLog.info('tdSql.checkRow(15)')
|
||||||
|
tdSql.checkRows(15)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m' %
|
||||||
|
(tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 1 then
|
||||||
|
tdLog.info('tdSql.checkRow(1)')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts < now + 4m and ts > now + 5m' %
|
||||||
|
(tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts < now + 4m and ts > now + 5m' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > 100000 and ts < 100000
|
||||||
|
tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > 100000 and ts < 100000' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 3m' %
|
||||||
|
(tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 3m' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and
|
||||||
|
# ts < now + 6m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
|
||||||
|
(tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 1 then
|
||||||
|
tdLog.info('tdSql.checkRow(1)')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step3
|
||||||
|
tdLog.info('=============== step3')
|
||||||
|
# TSIM: sql select * from $mt
|
||||||
|
tdLog.info('select * from %s' % (mt))
|
||||||
|
tdSql.query('select * from %s' % (mt))
|
||||||
|
# TSIM: if $rows != $totalNum then
|
||||||
|
tdLog.info('tdSql.checkRow($totalNum)')
|
||||||
|
tdSql.checkRows(totalNum)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sql select * from $mt where ts < now + 4m
|
||||||
|
tdLog.info('select * from %s where ts < now + 4m' % (mt))
|
||||||
|
tdSql.query('select * from %s where ts < now + 4m' % (mt))
|
||||||
|
# TSIM: if $rows != 50 then
|
||||||
|
tdLog.info('tdSql.checkRow(50)')
|
||||||
|
tdSql.checkRows(50)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m
|
||||||
|
tdLog.info('select * from %s where ts > now + 4m' % (mt))
|
||||||
|
tdSql.query('select * from %s where ts > now + 4m' % (mt))
|
||||||
|
# TSIM: if $rows != 150 then
|
||||||
|
tdLog.info('tdSql.checkRow(150)')
|
||||||
|
tdSql.checkRows(150)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts = now + 4m
|
||||||
|
tdLog.info('select * from %s where ts = now + 4m' % (mt))
|
||||||
|
tdSql.query('select * from %s where ts = now + 4m' % (mt))
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 10 then
|
||||||
|
tdLog.info('tdSql.checkRow(10)')
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step4
|
||||||
|
tdLog.info('=============== step4')
|
||||||
|
# TSIM: sql select * from $mt where tgcol = 0
|
||||||
|
tdLog.info('select * from %s where tgcol = 0' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol = 0' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol <> 0
|
||||||
|
tdLog.info('select * from %s where tgcol <> 0' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol <> 0' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol = 1
|
||||||
|
tdLog.info('select * from %s where tgcol = 1' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol = 1' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol <> 1
|
||||||
|
tdLog.info('select * from %s where tgcol <> 1' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol <> 1' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol = 1
|
||||||
|
tdLog.info('select * from %s where tgcol = 1' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol = 1' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol <> 1
|
||||||
|
tdLog.info('select * from %s where tgcol <> 1' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol <> 1' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol = 0
|
||||||
|
tdLog.info('select * from %s where tgcol = 0' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol = 0' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol <> 0
|
||||||
|
tdLog.info('select * from %s where tgcol <> 0' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol <> 0' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step5
|
||||||
|
tdLog.info('=============== step5')
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1
|
||||||
|
tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol = 1' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 75 then
|
||||||
|
tdLog.info('tdSql.checkRow(75)')
|
||||||
|
tdSql.checkRows(75)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol <> 1' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol <> 1' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 75 then
|
||||||
|
tdLog.info('tdSql.checkRow(75)')
|
||||||
|
tdSql.checkRows(75)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0
|
||||||
|
tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts < now + 4m and tgcol = 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 25 then
|
||||||
|
tdLog.info('tdSql.checkRow(25)')
|
||||||
|
tdSql.checkRows(25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts < now + 4m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts < now + 4m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 25 then
|
||||||
|
tdLog.info('tdSql.checkRow(25)')
|
||||||
|
tdSql.checkRows(25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts <= now + 4m and tgcol = 0' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts <= now + 4m and tgcol = 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 25 then
|
||||||
|
tdLog.info('tdSql.checkRow(25)')
|
||||||
|
tdSql.checkRows(25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts <= now + 4m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts <= now + 4m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 25 then
|
||||||
|
tdLog.info('tdSql.checkRow(25)')
|
||||||
|
tdSql.checkRows(25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
|
||||||
|
# tgcol <> 0
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 5 then
|
||||||
|
tdLog.info('tdSql.checkRow(5)')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts
|
||||||
|
# < now + 5m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 5 then
|
||||||
|
tdLog.info('tdSql.checkRow(5)')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step6
|
||||||
|
tdLog.info('=============== step6')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 200 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 200)')
|
||||||
|
tdSql.checkData(0, 0, 200)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step7
|
||||||
|
tdLog.info('=============== step7')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 100 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 100)')
|
||||||
|
tdSql.checkData(0, 0, 100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step8
|
||||||
|
tdLog.info('=============== step8')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 50 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 50)')
|
||||||
|
tdSql.checkData(0, 0, 50)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step9
|
||||||
|
tdLog.info('=============== step9')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 100 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 100)')
|
||||||
|
tdSql.checkData(0, 0, 100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step10
|
||||||
|
tdLog.info('=============== step10')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group
|
||||||
|
# by tgcol
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 100 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 100)')
|
||||||
|
tdSql.checkData(0, 0, 100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step11
|
||||||
|
tdLog.info('=============== step11')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
|
||||||
|
# group by tgcol
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 25 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 25)')
|
||||||
|
tdSql.checkData(0, 0, 25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step12
|
||||||
|
tdLog.info('=============== step12')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by
|
||||||
|
# tgcol
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data01 != 100 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 100)')
|
||||||
|
tdSql.checkData(0, 1, 100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== clear
|
||||||
|
tdLog.info('=============== clear')
|
||||||
|
# TSIM: sql drop database $db
|
||||||
|
tdLog.info('drop database db')
|
||||||
|
tdSql.execute('drop database db')
|
||||||
|
# TSIM: sql show databases
|
||||||
|
tdLog.info('show databases')
|
||||||
|
tdSql.query('show databases')
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
# convert end
|
||||||
|
tdSql.execute("create database db")
|
||||||
|
tdSql.execute("use db")
|
||||||
|
tdSql.execute(
|
||||||
|
"create table if not exists st (ts timestamp, tagtype int) tags(dev int unsigned)")
|
||||||
|
tdSql.error(
|
||||||
|
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (pow(2, 32) - 1))
|
||||||
|
tdSql.error(
|
||||||
|
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (-1))
|
||||||
|
|
||||||
|
tdSql.execute(
|
||||||
|
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (pow(2, 32) - 2))
|
||||||
|
tdSql.execute(
|
||||||
|
'CREATE TABLE if not exists dev_002 using st tags(%d)' % (0))
|
||||||
|
tdSql.execute(
|
||||||
|
'CREATE TABLE if not exists dev_003 using st tags(%s)' % ('NULL'))
|
||||||
|
print("==============step2")
|
||||||
|
tdSql.query("show tables")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -0,0 +1,603 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
|
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(), logSql)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
# TSIM: system sh/stop_dnodes.sh
|
||||||
|
# TSIM:
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
# TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0
|
||||||
|
# TSIM: system sh/exec.sh -n dnode1 -s start
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sleep 3000
|
||||||
|
# TSIM: sql connect
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print ======================== dnode1 start
|
||||||
|
tdLog.info('======================== dnode1 start')
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: $dbPrefix = ta_sm_db
|
||||||
|
# TSIM: $tbPrefix = ta_sm_tb
|
||||||
|
tbPrefix = "ta_sm_tb"
|
||||||
|
# TSIM: $mtPrefix = ta_sm_mt
|
||||||
|
mtPrefix = "ta_sm_mt"
|
||||||
|
# TSIM: $tbNum = 10
|
||||||
|
tbNum = 10
|
||||||
|
# TSIM: $rowNum = 20
|
||||||
|
rowNum = 20
|
||||||
|
# TSIM: $totalNum = 200
|
||||||
|
totalNum = 200
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step1
|
||||||
|
tdLog.info('=============== step1')
|
||||||
|
# TSIM: $i = 0
|
||||||
|
i = 0
|
||||||
|
# TSIM: $db = $dbPrefix . $i
|
||||||
|
# TSIM: $mt = $mtPrefix . $i
|
||||||
|
mt = "%s%d" % (mtPrefix, i)
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sql create database $db
|
||||||
|
# TSIM: sql use $db
|
||||||
|
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol
|
||||||
|
# smallint unsigned)
|
||||||
|
tdLog.info(
|
||||||
|
'create table %s (ts timestamp, tbcol int) TAGS(tgcol smallint unsigned)' %
|
||||||
|
(mt))
|
||||||
|
tdSql.execute(
|
||||||
|
'create table %s (ts timestamp, tbcol int) TAGS(tgcol smallint unsigned)' %
|
||||||
|
(mt))
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: $i = 0
|
||||||
|
i = 0
|
||||||
|
# TSIM: while $i < 5
|
||||||
|
while (i < 5):
|
||||||
|
# TSIM: $tb = $tbPrefix . $i
|
||||||
|
tb = "%s%d" % (tbPrefix, i)
|
||||||
|
# TSIM: sql create table $tb using $mt tags( 0 )
|
||||||
|
tdLog.info('create table %s using %s tags( 0 )' % (tb, mt))
|
||||||
|
tdSql.execute('create table %s using %s tags( 0 )' % (tb, mt))
|
||||||
|
# TSIM: $x = 0
|
||||||
|
x = 0
|
||||||
|
# TSIM: while $x < $rowNum
|
||||||
|
while (x < rowNum):
|
||||||
|
# TSIM: $ms = $x . m
|
||||||
|
ms = "%dm" % x
|
||||||
|
# TSIM: sql insert into $tb values (now + $ms , $x )
|
||||||
|
tdLog.info(
|
||||||
|
'insert into %s values (now + %s , %d )' %
|
||||||
|
(tb, ms, x))
|
||||||
|
tdSql.execute(
|
||||||
|
'insert into %s values (now + %s , %d )' %
|
||||||
|
(tb, ms, x))
|
||||||
|
# TSIM: $x = $x + 1
|
||||||
|
x = x + 1
|
||||||
|
# TSIM: endw
|
||||||
|
# TSIM: $i = $i + 1
|
||||||
|
i = i + 1
|
||||||
|
# TSIM: endw
|
||||||
|
# TSIM: while $i < 10
|
||||||
|
while (i < 10):
|
||||||
|
# TSIM: $tb = $tbPrefix . $i
|
||||||
|
tb = "%s%d" % (tbPrefix, i)
|
||||||
|
# TSIM: sql create table $tb using $mt tags( 1 )
|
||||||
|
tdLog.info('create table %s using %s tags( 1 )' % (tb, mt))
|
||||||
|
tdSql.execute('create table %s using %s tags( 1 )' % (tb, mt))
|
||||||
|
# TSIM: $x = 0
|
||||||
|
x = 0
|
||||||
|
# TSIM: while $x < $rowNum
|
||||||
|
while (x < rowNum):
|
||||||
|
# TSIM: $ms = $x . m
|
||||||
|
ms = "%dm" % x
|
||||||
|
# TSIM: sql insert into $tb values (now + $ms , $x )
|
||||||
|
tdLog.info(
|
||||||
|
'insert into %s values (now + %s , %d )' %
|
||||||
|
(tb, ms, x))
|
||||||
|
tdSql.execute(
|
||||||
|
'insert into %s values (now + %s , %d )' %
|
||||||
|
(tb, ms, x))
|
||||||
|
# TSIM: $x = $x + 1
|
||||||
|
x = x + 1
|
||||||
|
# TSIM: endw
|
||||||
|
# TSIM: $i = $i + 1
|
||||||
|
i = i + 1
|
||||||
|
# TSIM: endw
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step2
|
||||||
|
tdLog.info('=============== step2')
|
||||||
|
# TSIM: sleep 100
|
||||||
|
# TSIM: sql select * from $tb
|
||||||
|
tdLog.info('select * from %s' % (tb))
|
||||||
|
tdSql.query('select * from %s' % (tb))
|
||||||
|
# TSIM: if $rows != $rowNum then
|
||||||
|
tdLog.info('tdSql.checkRow($rowNum)')
|
||||||
|
tdSql.checkRows(rowNum)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts < now + 4m
|
||||||
|
tdLog.info('select * from %s where ts < now + 4m' % (tb))
|
||||||
|
tdSql.query('select * from %s where ts < now + 4m' % (tb))
|
||||||
|
# TSIM: if $rows != 5 then
|
||||||
|
tdLog.info('tdSql.checkRow(5)')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts <= now + 4m
|
||||||
|
tdLog.info('select * from %s where ts <= now + 4m' % (tb))
|
||||||
|
tdSql.query('select * from %s where ts <= now + 4m' % (tb))
|
||||||
|
# TSIM: if $rows != 5 then
|
||||||
|
tdLog.info('tdSql.checkRow(5)')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > now + 4m
|
||||||
|
tdLog.info('select * from %s where ts > now + 4m' % (tb))
|
||||||
|
tdSql.query('select * from %s where ts > now + 4m' % (tb))
|
||||||
|
# TSIM: if $rows != 15 then
|
||||||
|
tdLog.info('tdSql.checkRow(15)')
|
||||||
|
tdSql.checkRows(15)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts >= now + 4m
|
||||||
|
tdLog.info('select * from %s where ts >= now + 4m' % (tb))
|
||||||
|
tdSql.query('select * from %s where ts >= now + 4m' % (tb))
|
||||||
|
# TSIM: if $rows != 15 then
|
||||||
|
tdLog.info('tdSql.checkRow(15)')
|
||||||
|
tdSql.checkRows(15)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m' %
|
||||||
|
(tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 1 then
|
||||||
|
tdLog.info('tdSql.checkRow(1)')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts < now + 4m and ts > now + 5m' %
|
||||||
|
(tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts < now + 4m and ts > now + 5m' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > 100000 and ts < 100000
|
||||||
|
tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > 100000 and ts < 100000' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 3m' %
|
||||||
|
(tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 3m' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and
|
||||||
|
# ts < now + 6m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
|
||||||
|
(tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 1 then
|
||||||
|
tdLog.info('tdSql.checkRow(1)')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step3
|
||||||
|
tdLog.info('=============== step3')
|
||||||
|
# TSIM: sql select * from $mt
|
||||||
|
tdLog.info('select * from %s' % (mt))
|
||||||
|
tdSql.query('select * from %s' % (mt))
|
||||||
|
# TSIM: if $rows != $totalNum then
|
||||||
|
tdLog.info('tdSql.checkRow($totalNum)')
|
||||||
|
tdSql.checkRows(totalNum)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sql select * from $mt where ts < now + 4m
|
||||||
|
tdLog.info('select * from %s where ts < now + 4m' % (mt))
|
||||||
|
tdSql.query('select * from %s where ts < now + 4m' % (mt))
|
||||||
|
# TSIM: if $rows != 50 then
|
||||||
|
tdLog.info('tdSql.checkRow(50)')
|
||||||
|
tdSql.checkRows(50)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m
|
||||||
|
tdLog.info('select * from %s where ts > now + 4m' % (mt))
|
||||||
|
tdSql.query('select * from %s where ts > now + 4m' % (mt))
|
||||||
|
# TSIM: if $rows != 150 then
|
||||||
|
tdLog.info('tdSql.checkRow(150)')
|
||||||
|
tdSql.checkRows(150)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts = now + 4m
|
||||||
|
tdLog.info('select * from %s where ts = now + 4m' % (mt))
|
||||||
|
tdSql.query('select * from %s where ts = now + 4m' % (mt))
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 10 then
|
||||||
|
tdLog.info('tdSql.checkRow(10)')
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step4
|
||||||
|
tdLog.info('=============== step4')
|
||||||
|
# TSIM: sql select * from $mt where tgcol = 0
|
||||||
|
tdLog.info('select * from %s where tgcol = 0' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol = 0' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol <> 0
|
||||||
|
tdLog.info('select * from %s where tgcol <> 0' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol <> 0' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol = 1
|
||||||
|
tdLog.info('select * from %s where tgcol = 1' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol = 1' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol <> 1
|
||||||
|
tdLog.info('select * from %s where tgcol <> 1' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol <> 1' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol = 1
|
||||||
|
tdLog.info('select * from %s where tgcol = 1' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol = 1' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol <> 1
|
||||||
|
tdLog.info('select * from %s where tgcol <> 1' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol <> 1' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol = 0
|
||||||
|
tdLog.info('select * from %s where tgcol = 0' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol = 0' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol <> 0
|
||||||
|
tdLog.info('select * from %s where tgcol <> 0' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol <> 0' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step5
|
||||||
|
tdLog.info('=============== step5')
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1
|
||||||
|
tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol = 1' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 75 then
|
||||||
|
tdLog.info('tdSql.checkRow(75)')
|
||||||
|
tdSql.checkRows(75)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol <> 1' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol <> 1' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 75 then
|
||||||
|
tdLog.info('tdSql.checkRow(75)')
|
||||||
|
tdSql.checkRows(75)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0
|
||||||
|
tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts < now + 4m and tgcol = 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 25 then
|
||||||
|
tdLog.info('tdSql.checkRow(25)')
|
||||||
|
tdSql.checkRows(25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts < now + 4m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts < now + 4m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 25 then
|
||||||
|
tdLog.info('tdSql.checkRow(25)')
|
||||||
|
tdSql.checkRows(25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts <= now + 4m and tgcol = 0' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts <= now + 4m and tgcol = 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 25 then
|
||||||
|
tdLog.info('tdSql.checkRow(25)')
|
||||||
|
tdSql.checkRows(25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts <= now + 4m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts <= now + 4m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 25 then
|
||||||
|
tdLog.info('tdSql.checkRow(25)')
|
||||||
|
tdSql.checkRows(25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
|
||||||
|
# tgcol <> 0
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 5 then
|
||||||
|
tdLog.info('tdSql.checkRow(5)')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts
|
||||||
|
# < now + 5m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 5 then
|
||||||
|
tdLog.info('tdSql.checkRow(5)')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step6
|
||||||
|
tdLog.info('=============== step6')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 200 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 200)')
|
||||||
|
tdSql.checkData(0, 0, 200)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step7
|
||||||
|
tdLog.info('=============== step7')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 100 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 100)')
|
||||||
|
tdSql.checkData(0, 0, 100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step8
|
||||||
|
tdLog.info('=============== step8')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 50 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 50)')
|
||||||
|
tdSql.checkData(0, 0, 50)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step9
|
||||||
|
tdLog.info('=============== step9')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 100 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 100)')
|
||||||
|
tdSql.checkData(0, 0, 100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step10
|
||||||
|
tdLog.info('=============== step10')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group
|
||||||
|
# by tgcol
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 100 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 100)')
|
||||||
|
tdSql.checkData(0, 0, 100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step11
|
||||||
|
tdLog.info('=============== step11')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
|
||||||
|
# group by tgcol
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 25 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 25)')
|
||||||
|
tdSql.checkData(0, 0, 25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step12
|
||||||
|
tdLog.info('=============== step12')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by
|
||||||
|
# tgcol
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data01 != 100 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 100)')
|
||||||
|
tdSql.checkData(0, 1, 100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== clear
|
||||||
|
tdLog.info('=============== clear')
|
||||||
|
# TSIM: sql drop database $db
|
||||||
|
tdLog.info('drop database db')
|
||||||
|
tdSql.execute('drop database db')
|
||||||
|
# TSIM: sql show databases
|
||||||
|
tdLog.info('show databases')
|
||||||
|
tdSql.query('show databases')
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
# convert end
|
||||||
|
tdSql.execute("create database db")
|
||||||
|
tdSql.execute("use db")
|
||||||
|
tdSql.execute(
|
||||||
|
"create table if not exists st (ts timestamp, tagtype int) tags(dev smallint unsigned)")
|
||||||
|
tdSql.error(
|
||||||
|
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (pow(2, 16)-1))
|
||||||
|
tdSql.error(
|
||||||
|
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (-1))
|
||||||
|
|
||||||
|
tdSql.execute(
|
||||||
|
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (pow(2, 16) - 2))
|
||||||
|
tdSql.execute(
|
||||||
|
'CREATE TABLE if not exists dev_002 using st tags(%d)' % (0))
|
||||||
|
tdSql.execute(
|
||||||
|
'CREATE TABLE if not exists dev_003 using st tags(%s)' % ('NULL'))
|
||||||
|
|
||||||
|
print("==============step2")
|
||||||
|
tdSql.query("show tables")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -0,0 +1,602 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
|
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(), logSql)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
# TSIM: system sh/stop_dnodes.sh
|
||||||
|
# TSIM:
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
# TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0
|
||||||
|
# TSIM: system sh/exec.sh -n dnode1 -s start
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sleep 3000
|
||||||
|
# TSIM: sql connect
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print ======================== dnode1 start
|
||||||
|
tdLog.info('======================== dnode1 start')
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: $dbPrefix = ta_sm_db
|
||||||
|
# TSIM: $tbPrefix = ta_sm_tb
|
||||||
|
tbPrefix = "ta_sm_tb"
|
||||||
|
# TSIM: $mtPrefix = ta_sm_mt
|
||||||
|
mtPrefix = "ta_sm_mt"
|
||||||
|
# TSIM: $tbNum = 10
|
||||||
|
tbNum = 10
|
||||||
|
# TSIM: $rowNum = 20
|
||||||
|
rowNum = 20
|
||||||
|
# TSIM: $totalNum = 200
|
||||||
|
totalNum = 200
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step1
|
||||||
|
tdLog.info('=============== step1')
|
||||||
|
# TSIM: $i = 0
|
||||||
|
i = 0
|
||||||
|
# TSIM: $db = $dbPrefix . $i
|
||||||
|
# TSIM: $mt = $mtPrefix . $i
|
||||||
|
mt = "%s%d" % (mtPrefix, i)
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sql create database $db
|
||||||
|
# TSIM: sql use $db
|
||||||
|
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol
|
||||||
|
# tinyint unsigned)
|
||||||
|
tdLog.info(
|
||||||
|
'create table %s (ts timestamp, tbcol int) TAGS(tgcol tinyint unsigned)' %
|
||||||
|
(mt))
|
||||||
|
tdSql.execute(
|
||||||
|
'create table %s (ts timestamp, tbcol int) TAGS(tgcol tinyint unsigned)' %
|
||||||
|
(mt))
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: $i = 0
|
||||||
|
i = 0
|
||||||
|
# TSIM: while $i < 5
|
||||||
|
while (i < 5):
|
||||||
|
# TSIM: $tb = $tbPrefix . $i
|
||||||
|
tb = "%s%d" % (tbPrefix, i)
|
||||||
|
# TSIM: sql create table $tb using $mt tags( 0 )
|
||||||
|
tdLog.info('create table %s using %s tags( 0 )' % (tb, mt))
|
||||||
|
tdSql.execute('create table %s using %s tags( 0 )' % (tb, mt))
|
||||||
|
# TSIM: $x = 0
|
||||||
|
x = 0
|
||||||
|
# TSIM: while $x < $rowNum
|
||||||
|
while (x < rowNum):
|
||||||
|
# TSIM: $ms = $x . m
|
||||||
|
ms = "%dm" % x
|
||||||
|
# TSIM: sql insert into $tb values (now + $ms , $x )
|
||||||
|
tdLog.info(
|
||||||
|
'insert into %s values (now + %s , %d )' %
|
||||||
|
(tb, ms, x))
|
||||||
|
tdSql.execute(
|
||||||
|
'insert into %s values (now + %s , %d )' %
|
||||||
|
(tb, ms, x))
|
||||||
|
# TSIM: $x = $x + 1
|
||||||
|
x = x + 1
|
||||||
|
# TSIM: endw
|
||||||
|
# TSIM: $i = $i + 1
|
||||||
|
i = i + 1
|
||||||
|
# TSIM: endw
|
||||||
|
# TSIM: while $i < 10
|
||||||
|
while (i < 10):
|
||||||
|
# TSIM: $tb = $tbPrefix . $i
|
||||||
|
tb = "%s%d" % (tbPrefix, i)
|
||||||
|
# TSIM: sql create table $tb using $mt tags( 1 )
|
||||||
|
tdLog.info('create table %s using %s tags( 1 )' % (tb, mt))
|
||||||
|
tdSql.execute('create table %s using %s tags( 1 )' % (tb, mt))
|
||||||
|
# TSIM: $x = 0
|
||||||
|
x = 0
|
||||||
|
# TSIM: while $x < $rowNum
|
||||||
|
while (x < rowNum):
|
||||||
|
# TSIM: $ms = $x . m
|
||||||
|
ms = "%dm" % x
|
||||||
|
# TSIM: sql insert into $tb values (now + $ms , $x )
|
||||||
|
tdLog.info(
|
||||||
|
'insert into %s values (now + %s , %d )' %
|
||||||
|
(tb, ms, x))
|
||||||
|
tdSql.execute(
|
||||||
|
'insert into %s values (now + %s , %d )' %
|
||||||
|
(tb, ms, x))
|
||||||
|
# TSIM: $x = $x + 1
|
||||||
|
x = x + 1
|
||||||
|
# TSIM: endw
|
||||||
|
# TSIM: $i = $i + 1
|
||||||
|
i = i + 1
|
||||||
|
# TSIM: endw
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step2
|
||||||
|
tdLog.info('=============== step2')
|
||||||
|
# TSIM: sleep 100
|
||||||
|
# TSIM: sql select * from $tb
|
||||||
|
tdLog.info('select * from %s' % (tb))
|
||||||
|
tdSql.query('select * from %s' % (tb))
|
||||||
|
# TSIM: if $rows != $rowNum then
|
||||||
|
tdLog.info('tdSql.checkRow($rowNum)')
|
||||||
|
tdSql.checkRows(rowNum)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts < now + 4m
|
||||||
|
tdLog.info('select * from %s where ts < now + 4m' % (tb))
|
||||||
|
tdSql.query('select * from %s where ts < now + 4m' % (tb))
|
||||||
|
# TSIM: if $rows != 5 then
|
||||||
|
tdLog.info('tdSql.checkRow(5)')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts <= now + 4m
|
||||||
|
tdLog.info('select * from %s where ts <= now + 4m' % (tb))
|
||||||
|
tdSql.query('select * from %s where ts <= now + 4m' % (tb))
|
||||||
|
# TSIM: if $rows != 5 then
|
||||||
|
tdLog.info('tdSql.checkRow(5)')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > now + 4m
|
||||||
|
tdLog.info('select * from %s where ts > now + 4m' % (tb))
|
||||||
|
tdSql.query('select * from %s where ts > now + 4m' % (tb))
|
||||||
|
# TSIM: if $rows != 15 then
|
||||||
|
tdLog.info('tdSql.checkRow(15)')
|
||||||
|
tdSql.checkRows(15)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts >= now + 4m
|
||||||
|
tdLog.info('select * from %s where ts >= now + 4m' % (tb))
|
||||||
|
tdSql.query('select * from %s where ts >= now + 4m' % (tb))
|
||||||
|
# TSIM: if $rows != 15 then
|
||||||
|
tdLog.info('tdSql.checkRow(15)')
|
||||||
|
tdSql.checkRows(15)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m' %
|
||||||
|
(tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 1 then
|
||||||
|
tdLog.info('tdSql.checkRow(1)')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts < now + 4m and ts > now + 5m' %
|
||||||
|
(tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts < now + 4m and ts > now + 5m' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > 100000 and ts < 100000
|
||||||
|
tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > 100000 and ts < 100000' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 3m' %
|
||||||
|
(tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 3m' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and
|
||||||
|
# ts < now + 6m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
|
||||||
|
(tb))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
|
||||||
|
(tb))
|
||||||
|
# TSIM: if $rows != 1 then
|
||||||
|
tdLog.info('tdSql.checkRow(1)')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step3
|
||||||
|
tdLog.info('=============== step3')
|
||||||
|
# TSIM: sql select * from $mt
|
||||||
|
tdLog.info('select * from %s' % (mt))
|
||||||
|
tdSql.query('select * from %s' % (mt))
|
||||||
|
# TSIM: if $rows != $totalNum then
|
||||||
|
tdLog.info('tdSql.checkRow($totalNum)')
|
||||||
|
tdSql.checkRows(totalNum)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: sql select * from $mt where ts < now + 4m
|
||||||
|
tdLog.info('select * from %s where ts < now + 4m' % (mt))
|
||||||
|
tdSql.query('select * from %s where ts < now + 4m' % (mt))
|
||||||
|
# TSIM: if $rows != 50 then
|
||||||
|
tdLog.info('tdSql.checkRow(50)')
|
||||||
|
tdSql.checkRows(50)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m
|
||||||
|
tdLog.info('select * from %s where ts > now + 4m' % (mt))
|
||||||
|
tdSql.query('select * from %s where ts > now + 4m' % (mt))
|
||||||
|
# TSIM: if $rows != 150 then
|
||||||
|
tdLog.info('tdSql.checkRow(150)')
|
||||||
|
tdSql.checkRows(150)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts = now + 4m
|
||||||
|
tdLog.info('select * from %s where ts = now + 4m' % (mt))
|
||||||
|
tdSql.query('select * from %s where ts = now + 4m' % (mt))
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 10 then
|
||||||
|
tdLog.info('tdSql.checkRow(10)')
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step4
|
||||||
|
tdLog.info('=============== step4')
|
||||||
|
# TSIM: sql select * from $mt where tgcol = 0
|
||||||
|
tdLog.info('select * from %s where tgcol = 0' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol = 0' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol <> 0
|
||||||
|
tdLog.info('select * from %s where tgcol <> 0' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol <> 0' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol = 1
|
||||||
|
tdLog.info('select * from %s where tgcol = 1' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol = 1' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol <> 1
|
||||||
|
tdLog.info('select * from %s where tgcol <> 1' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol <> 1' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol = 1
|
||||||
|
tdLog.info('select * from %s where tgcol = 1' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol = 1' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol <> 1
|
||||||
|
tdLog.info('select * from %s where tgcol <> 1' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol <> 1' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol = 0
|
||||||
|
tdLog.info('select * from %s where tgcol = 0' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol = 0' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where tgcol <> 0
|
||||||
|
tdLog.info('select * from %s where tgcol <> 0' % (mt))
|
||||||
|
tdSql.query('select * from %s where tgcol <> 0' % (mt))
|
||||||
|
# TSIM: if $rows != 100 then
|
||||||
|
tdLog.info('tdSql.checkRow(100)')
|
||||||
|
tdSql.checkRows(100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step5
|
||||||
|
tdLog.info('=============== step5')
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1
|
||||||
|
tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol = 1' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 75 then
|
||||||
|
tdLog.info('tdSql.checkRow(75)')
|
||||||
|
tdSql.checkRows(75)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol <> 1' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol <> 1' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 75 then
|
||||||
|
tdLog.info('tdSql.checkRow(75)')
|
||||||
|
tdSql.checkRows(75)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0
|
||||||
|
tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts < now + 4m and tgcol = 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 25 then
|
||||||
|
tdLog.info('tdSql.checkRow(25)')
|
||||||
|
tdSql.checkRows(25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts < now + 4m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts < now + 4m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 25 then
|
||||||
|
tdLog.info('tdSql.checkRow(25)')
|
||||||
|
tdSql.checkRows(25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts <= now + 4m and tgcol = 0' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts <= now + 4m and tgcol = 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 25 then
|
||||||
|
tdLog.info('tdSql.checkRow(25)')
|
||||||
|
tdSql.checkRows(25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts <= now + 4m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts <= now + 4m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 25 then
|
||||||
|
tdLog.info('tdSql.checkRow(25)')
|
||||||
|
tdSql.checkRows(25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
|
||||||
|
# tgcol <> 0
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 5 then
|
||||||
|
tdLog.info('tdSql.checkRow(5)')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts
|
||||||
|
# < now + 5m
|
||||||
|
tdLog.info(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: if $rows != 5 then
|
||||||
|
tdLog.info('tdSql.checkRow(5)')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step6
|
||||||
|
tdLog.info('=============== step6')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 200 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 200)')
|
||||||
|
tdSql.checkData(0, 0, 200)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step7
|
||||||
|
tdLog.info('=============== step7')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 100 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 100)')
|
||||||
|
tdSql.checkData(0, 0, 100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step8
|
||||||
|
tdLog.info('=============== step8')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 50 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 50)')
|
||||||
|
tdSql.checkData(0, 0, 50)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step9
|
||||||
|
tdLog.info('=============== step9')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 100 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 100)')
|
||||||
|
tdSql.checkData(0, 0, 100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step10
|
||||||
|
tdLog.info('=============== step10')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group
|
||||||
|
# by tgcol
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 100 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 100)')
|
||||||
|
tdSql.checkData(0, 0, 100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step11
|
||||||
|
tdLog.info('=============== step11')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
|
||||||
|
# group by tgcol
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data00 != 25 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 0, 25)')
|
||||||
|
tdSql.checkData(0, 0, 25)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== step12
|
||||||
|
tdLog.info('=============== step12')
|
||||||
|
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
|
||||||
|
# max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by
|
||||||
|
# tgcol
|
||||||
|
tdLog.info(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
tdSql.query(
|
||||||
|
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' %
|
||||||
|
(mt))
|
||||||
|
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
|
||||||
|
# TSIM: if $data01 != 100 then
|
||||||
|
tdLog.info('tdSql.checkData(0, 1, 100)')
|
||||||
|
tdSql.checkData(0, 1, 100)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: print =============== clear
|
||||||
|
tdLog.info('=============== clear')
|
||||||
|
# TSIM: sql drop database $db
|
||||||
|
tdLog.info('drop database db')
|
||||||
|
tdSql.execute('drop database db')
|
||||||
|
# TSIM: sql show databases
|
||||||
|
tdLog.info('show databases')
|
||||||
|
tdSql.query('show databases')
|
||||||
|
# TSIM: if $rows != 0 then
|
||||||
|
tdLog.info('tdSql.checkRow(0)')
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
# TSIM: return -1
|
||||||
|
# TSIM: endi
|
||||||
|
# TSIM:
|
||||||
|
# TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
# convert end
|
||||||
|
tdSql.execute("create database db")
|
||||||
|
tdSql.execute("use db")
|
||||||
|
tdSql.execute(
|
||||||
|
"create table if not exists st (ts timestamp, tagtype int) tags(dev tinyint unsigned)")
|
||||||
|
tdSql.error(
|
||||||
|
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (pow(2, 8) - 1))
|
||||||
|
tdSql.error(
|
||||||
|
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (-1))
|
||||||
|
|
||||||
|
tdSql.execute(
|
||||||
|
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (pow(2, 8) - 2))
|
||||||
|
tdSql.execute(
|
||||||
|
'CREATE TABLE if not exists dev_002 using st tags(%d)' % (0))
|
||||||
|
tdSql.execute(
|
||||||
|
'CREATE TABLE if not exists dev_003 using st tags(%s)' % ('NULL'))
|
||||||
|
print("==============step2")
|
||||||
|
tdSql.query("show tables")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -209,7 +209,7 @@ sql alter database db wal 1
|
||||||
sql alter database db wal 2
|
sql alter database db wal 2
|
||||||
sql alter database db wal 1
|
sql alter database db wal 1
|
||||||
sql alter database db wal 2
|
sql alter database db wal 2
|
||||||
sql_error alter database db wal 0
|
sql alter database db wal 0
|
||||||
sql_error alter database db wal 3
|
sql_error alter database db wal 3
|
||||||
sql_error alter database db wal 4
|
sql_error alter database db wal 4
|
||||||
sql_error alter database db wal -1
|
sql_error alter database db wal -1
|
||||||
|
|
|
@ -39,14 +39,14 @@ print =============== step3 - query data
|
||||||
|
|
||||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest' 127.0.0.1:7111/rest/sql
|
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest' 127.0.0.1:7111/rest/sql
|
||||||
print curl 127.0.0.1:7111/rest/sql -----> $system_content
|
print curl 127.0.0.1:7111/rest/sql -----> $system_content
|
||||||
if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10]],"rows":10}@ then
|
if $system_content != @{"status":"succ","head":["ts","i"],"column_meta":[["ts",9,8],["i",4,4]],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10]],"rows":10}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
print =============== step4 - insert data
|
print =============== step4 - insert data
|
||||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.table_rest values('2017-12-25 21:28:51.022', 11)" 127.0.0.1:7111/rest/sql
|
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.table_rest values('2017-12-25 21:28:51.022', 11)" 127.0.0.1:7111/rest/sql
|
||||||
print curl 127.0.0.1:7111/rest/sql -----> $system_content
|
print curl 127.0.0.1:7111/rest/sql -----> $system_content
|
||||||
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then
|
if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[1]],"rows":1}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ print =============== step5 - query data
|
||||||
|
|
||||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest' 127.0.0.1:7111/rest/sql
|
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest' 127.0.0.1:7111/rest/sql
|
||||||
print curl 127.0.0.1:7111/rest/sql -----> $system_content
|
print curl 127.0.0.1:7111/rest/sql -----> $system_content
|
||||||
if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:51.022",11]],"rows":11}@ then
|
if $system_content != @{"status":"succ","head":["ts","i"],"column_meta":[["ts",9,8],["i",4,4]],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:51.022",11]],"rows":11}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -88,13 +88,13 @@ print =============== step2 - no db
|
||||||
#11
|
#11
|
||||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:7111/rest/sql
|
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:7111/rest/sql
|
||||||
print 11-> $system_content
|
print 11-> $system_content
|
||||||
if $system_content != @{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep0,keep1,keep(D)","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"data":[],"rows":0}@ then
|
if $system_content != @{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep0,keep1,keep(D)","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep0,keep1,keep(D)",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[],"rows":0}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d1' 127.0.0.1:7111/rest/sql
|
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d1' 127.0.0.1:7111/rest/sql
|
||||||
print 12-> $system_content
|
print 12-> $system_content
|
||||||
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[0]],"rows":1}@ then
|
if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[0]],"rows":1}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -160,26 +160,26 @@ endi
|
||||||
|
|
||||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' create table d1.t1 (ts timestamp, speed int)' 127.0.0.1:7111/rest/sql
|
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' create table d1.t1 (ts timestamp, speed int)' 127.0.0.1:7111/rest/sql
|
||||||
print 22-> $system_content
|
print 22-> $system_content
|
||||||
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[0]],"rows":1}@ then
|
if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[0]],"rows":1}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:7111/rest/sql
|
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:7111/rest/sql
|
||||||
print 23-> $system_content
|
print 23-> $system_content
|
||||||
if $system_content != @{"status":"succ","head":["ts","speed"],"data":[],"rows":0}@ then
|
if $system_content != @{"status":"succ","head":["ts","speed"],"column_meta":[["ts",9,8],["speed",4,4]],"data":[],"rows":0}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
#24
|
#24
|
||||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:41.022', 1)" 127.0.0.1:7111/rest/sql
|
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:41.022', 1)" 127.0.0.1:7111/rest/sql
|
||||||
print 24-> $system_content
|
print 24-> $system_content
|
||||||
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then
|
if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[1]],"rows":1}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:7111/rest/sql
|
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:7111/rest/sql
|
||||||
print 25-> $system_content
|
print 25-> $system_content
|
||||||
if $system_content != @{"status":"succ","head":["ts","speed"],"data":[["2017-12-25 21:28:41.022",1]],"rows":1}@ then
|
if $system_content != @{"status":"succ","head":["ts","speed"],"column_meta":[["ts",9,8],["speed",4,4]],"data":[["2017-12-25 21:28:41.022",1]],"rows":1}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -208,32 +208,32 @@ system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl
|
||||||
#27
|
#27
|
||||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:7111/rest/sql
|
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:7111/rest/sql
|
||||||
print 27-> $system_content
|
print 27-> $system_content
|
||||||
if $system_content != @{"status":"succ","head":["ts","speed"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:51.022",11]],"rows":11}@ then
|
if $system_content != @{"status":"succ","head":["ts","speed"],"column_meta":[["ts",9,8],["speed",4,4]],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:51.022",11]],"rows":11}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d2' 127.0.0.1:7111/rest/sql
|
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d2' 127.0.0.1:7111/rest/sql
|
||||||
print 28-> $system_content
|
print 28-> $system_content
|
||||||
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[0]],"rows":1}@ then
|
if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[0]],"rows":1}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' create table d2.t1 (ts timestamp, speed int)' 127.0.0.1:7111/rest/sql
|
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' create table d2.t1 (ts timestamp, speed int)' 127.0.0.1:7111/rest/sql
|
||||||
print 29-> $system_content
|
print 29-> $system_content
|
||||||
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[0]],"rows":1}@ then
|
if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[0]],"rows":1}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
#30
|
#30
|
||||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d2.t1 values('2017-12-25 21:28:41.022', 1)" 127.0.0.1:7111/rest/sql
|
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d2.t1 values('2017-12-25 21:28:41.022', 1)" 127.0.0.1:7111/rest/sql
|
||||||
print 30-> $system_content
|
print 30-> $system_content
|
||||||
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then
|
if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[1]],"rows":1}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d2.t1 ' 127.0.0.1:7111/rest/sql
|
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d2.t1 ' 127.0.0.1:7111/rest/sql
|
||||||
print 31-> $system_content
|
print 31-> $system_content
|
||||||
if $system_content != @{"status":"succ","head":["ts","speed"],"data":[["2017-12-25 21:28:41.022",1]],"rows":1}@ then
|
if $system_content != @{"status":"succ","head":["ts","speed"],"column_meta":[["ts",9,8],["speed",4,4]],"data":[["2017-12-25 21:28:41.022",1]],"rows":1}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -285,7 +285,7 @@ system_content curl -u root:taosdata -d 'select count(*) from db.win_cpu' 127.0
|
||||||
|
|
||||||
print $system_content
|
print $system_content
|
||||||
|
|
||||||
if $system_content != @{"status":"succ","head":["count(*)"],"data":[[3]],"rows":1}@ then
|
if $system_content != @{"status":"succ","head":["count(*)"],"column_meta":[["count(*)",5,8]],"data":[[3]],"rows":1}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -169,8 +169,8 @@ sql_error create database $db cache 0
|
||||||
sql_error create database $db ctime 29
|
sql_error create database $db ctime 29
|
||||||
sql_error create database $db ctime 40961
|
sql_error create database $db ctime 40961
|
||||||
|
|
||||||
# wal {1, 2}
|
# wal {0, 2}
|
||||||
sql_error create database $db wal 0
|
#sql_error create database $db wal 0
|
||||||
sql_error create database $db wal -1
|
sql_error create database $db wal -1
|
||||||
sql_error create database $db wal 3
|
sql_error create database $db wal 3
|
||||||
|
|
||||||
|
|
|
@ -15,18 +15,18 @@ print ========== step2
|
||||||
# return -1
|
# return -1
|
||||||
#step21:
|
#step21:
|
||||||
sql drop table log.dn -x step22
|
sql drop table log.dn -x step22
|
||||||
return -1
|
# return -1
|
||||||
step22:
|
step22:
|
||||||
sql drop user log -x step23
|
sql drop user log -x step23
|
||||||
return -1
|
# return -1
|
||||||
step23:
|
step23:
|
||||||
|
|
||||||
print ========== step3
|
print ========== step3
|
||||||
|
|
||||||
sleep 2000
|
sleep 2000
|
||||||
sql select * from log.dn
|
#sql select * from log.dn
|
||||||
if $rows == 0 then
|
#if $rows == 0 then
|
||||||
return -1
|
# return -1
|
||||||
endi
|
#endi
|
||||||
|
|
||||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -169,7 +169,7 @@ endi
|
||||||
|
|
||||||
system_content curl -u root:taosdata -d 'select * from db.sys_cpu_d_bbb_lga_1_web01' 127.0.0.1:7111/rest/sql/
|
system_content curl -u root:taosdata -d 'select * from db.sys_cpu_d_bbb_lga_1_web01' 127.0.0.1:7111/rest/sql/
|
||||||
print $system_content
|
print $system_content
|
||||||
if $system_content != @{"status":"succ","head":["ts","value"],"data":[["2012-09-05 20:00:00.000",18.000000000]],"rows":1}@ then
|
if $system_content != @{"status":"succ","head":["ts","value"],"column_meta":[["ts",9,8],["value",7,8]],"data":[["2012-09-05 20:00:00.000",18.000000000]],"rows":1}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ system_content curl -u root:taosdata -d 'select * from db.sys_cpu_d_bbb_lga_1_w
|
||||||
|
|
||||||
print $system_content
|
print $system_content
|
||||||
|
|
||||||
if $system_content != @{"status":"succ","head":["ts","value"],"data":[["2012-09-05 20:00:00.000",18.000000000],["2012-09-05 20:00:05.000",18.000000000]],"rows":2}@ then
|
if $system_content != @{"status":"succ","head":["ts","value"],"column_meta":[["ts",9,8],["value",7,8]],"data":[["2012-09-05 20:00:00.000",18.000000000],["2012-09-05 20:00:05.000",18.000000000]],"rows":2}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ system_content curl -u root:taosdata -d 'select count(*) from db.sys_cpu_d_bbb'
|
||||||
|
|
||||||
print $system_content
|
print $system_content
|
||||||
|
|
||||||
if $system_content != @{"status":"succ","head":["count(*)"],"data":[[3]],"rows":1}@ then
|
if $system_content != @{"status":"succ","head":["count(*)"],"column_meta":[["count(*)",5,8]],"data":[[3]],"rows":1}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ system_content curl -u root:taosdata -d 'select * from db.sys_mem_d_bbb_lga_1_w
|
||||||
|
|
||||||
print $system_content
|
print $system_content
|
||||||
|
|
||||||
if $system_content != @{"status":"succ","head":["ts","value"],"data":[["2012-09-05 20:00:00.000",8.000000000],["2012-09-05 20:00:05.000",9.000000000]],"rows":2}@ then
|
if $system_content != @{"status":"succ","head":["ts","value"],"column_meta":[["ts",9,8],["value",7,8]],"data":[["2012-09-05 20:00:00.000",8.000000000],["2012-09-05 20:00:05.000",9.000000000]],"rows":2}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ system_content curl -u root:taosdata -d 'select count(*) from db.sys_mem_d_bbb'
|
||||||
|
|
||||||
print $system_content
|
print $system_content
|
||||||
|
|
||||||
if $system_content != @{"status":"succ","head":["count(*)"],"data":[[2]],"rows":1}@ then
|
if $system_content != @{"status":"succ","head":["count(*)"],"column_meta":[["count(*)",5,8]],"data":[[2]],"rows":1}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 134
|
||||||
|
|
||||||
system_content curl -u root:taosdata -d 'select count(*) from db.sys_cpu_d_bbb' 127.0.0.1:7111/rest/sql/
|
system_content curl -u root:taosdata -d 'select count(*) from db.sys_cpu_d_bbb' 127.0.0.1:7111/rest/sql/
|
||||||
print $system_content
|
print $system_content
|
||||||
if $system_content != @{"status":"succ","head":["count(*)"],"data":[[7]],"rows":1}@ then
|
if $system_content != @{"status":"succ","head":["count(*)"],"column_meta":[["count(*)",5,8]],"data":[[7]],"rows":1}@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,7 @@ char *simGetVariable(SScript *script, char *varName, int32_t varLen) {
|
||||||
int32_t simExecuteExpression(SScript *script, char *exp) {
|
int32_t simExecuteExpression(SScript *script, char *exp) {
|
||||||
char * op1, *op2, *var1, *var2, *var3, *rest;
|
char * op1, *op2, *var1, *var2, *var3, *rest;
|
||||||
int32_t op1Len, op2Len, var1Len, var2Len, var3Len, val0, val1;
|
int32_t op1Len, op2Len, var1Len, var2Len, var3Len, val0, val1;
|
||||||
char t0[512], t1[512], t2[512], t3[1024];
|
char t0[1024], t1[1024], t2[1024], t3[2048];
|
||||||
int32_t result;
|
int32_t result;
|
||||||
|
|
||||||
rest = paGetToken(exp, &var1, &var1Len);
|
rest = paGetToken(exp, &var1, &var1Len);
|
||||||
|
|
Loading…
Reference in New Issue