Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
808e47d2
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
808e47d2
编写于
1月 20, 2022
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
(query):diff ignore negative test case
上级
c2ac8b38
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
154 addition
and
0 deletion
+154
-0
tests/develop-test/2-query/diff_ignore_negative.py
tests/develop-test/2-query/diff_ignore_negative.py
+153
-0
tests/develop-test/fulltest-query.sh
tests/develop-test/fulltest-query.sh
+1
-0
未找到文件。
tests/develop-test/2-query/diff_ignore_negative.py
0 → 100644
浏览文件 @
808e47d2
import
sys
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
class
TDTestCase
:
def
caseDescription
(
self
):
'''
case1<shenglian zhou>: [TD-11204]Difference improvement that can ignore negative
'''
return
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
_conn
=
conn
def
run
(
self
):
print
(
"running {}"
.
format
(
__file__
))
tdSql
.
execute
(
"drop database if exists diffneg"
)
tdSql
.
execute
(
"create database if not exists diffneg"
)
tdSql
.
execute
(
'use diffneg'
)
tdSql
.
execute
(
'create table st(ts timestamp, c1 int, c2 float) tags(t int);'
)
tdSql
.
execute
(
'create table ct1 using st tags(1);'
)
tdSql
.
execute
(
'create table ct2 using st tags(2);'
)
tdSql
.
execute
(
'insert into ct1 values(1642662622000, 1, 2)(1642662622001, 2, 4)(1642662622003, -4, -6)(1642662622004, 4, 8);'
)
tdSql
.
execute
(
'insert into ct2 values(1642662622001, 11, 22)(1642662622002, 22, 44)(1642662622003, -44, -66) (1642662622004, 44, 88);'
)
tdSql
.
query
(
'select diff(c1) from st group by tbname'
)
tdSql
.
checkRows
(
6
)
tdSql
.
checkData
(
0
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
1000
))
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
0
,
2
,
'ct1'
)
tdSql
.
checkData
(
1
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
3000
))
tdSql
.
checkData
(
1
,
1
,
-
6
)
tdSql
.
checkData
(
1
,
2
,
'ct1'
)
tdSql
.
checkData
(
2
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
4000
))
tdSql
.
checkData
(
2
,
1
,
8
)
tdSql
.
checkData
(
2
,
2
,
'ct1'
)
tdSql
.
checkData
(
3
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
2000
))
tdSql
.
checkData
(
3
,
1
,
11
)
tdSql
.
checkData
(
3
,
2
,
'ct2'
)
tdSql
.
checkData
(
4
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
3000
))
tdSql
.
checkData
(
4
,
1
,
-
66
)
tdSql
.
checkData
(
4
,
2
,
'ct2'
)
tdSql
.
checkData
(
5
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
4000
))
tdSql
.
checkData
(
5
,
1
,
88
)
tdSql
.
checkData
(
5
,
2
,
'ct2'
)
tdSql
.
query
(
'select diff(c1,0) from st group by tbname'
)
tdSql
.
checkRows
(
6
)
tdSql
.
checkData
(
0
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
1000
))
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
0
,
2
,
'ct1'
)
tdSql
.
checkData
(
1
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
3000
))
tdSql
.
checkData
(
1
,
1
,
-
6
)
tdSql
.
checkData
(
1
,
2
,
'ct1'
)
tdSql
.
checkData
(
2
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
4000
))
tdSql
.
checkData
(
2
,
1
,
8
)
tdSql
.
checkData
(
2
,
2
,
'ct1'
)
tdSql
.
checkData
(
3
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
2000
))
tdSql
.
checkData
(
3
,
1
,
11
)
tdSql
.
checkData
(
3
,
2
,
'ct2'
)
tdSql
.
checkData
(
4
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
3000
))
tdSql
.
checkData
(
4
,
1
,
-
66
)
tdSql
.
checkData
(
4
,
2
,
'ct2'
)
tdSql
.
checkData
(
5
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
4000
))
tdSql
.
checkData
(
5
,
1
,
88
)
tdSql
.
checkData
(
5
,
2
,
'ct2'
)
tdSql
.
query
(
'select diff(c1,1) from st group by tbname'
)
tdSql
.
checkRows
(
4
)
tdSql
.
checkData
(
0
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
1000
))
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
0
,
2
,
'ct1'
)
tdSql
.
checkData
(
1
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
4000
))
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
checkData
(
1
,
2
,
'ct1'
)
tdSql
.
checkData
(
2
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
2000
))
tdSql
.
checkData
(
2
,
1
,
11
)
tdSql
.
checkData
(
2
,
2
,
'ct2'
)
tdSql
.
checkData
(
3
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
4000
))
tdSql
.
checkData
(
3
,
1
,
22
)
tdSql
.
checkData
(
3
,
2
,
'ct2'
)
tdSql
.
query
(
'select diff(c2) from st group by tbname'
)
tdSql
.
checkRows
(
6
)
tdSql
.
checkData
(
0
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
1000
))
tdSql
.
checkData
(
0
,
1
,
2.0
)
tdSql
.
checkData
(
0
,
2
,
'ct1'
)
tdSql
.
checkData
(
1
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
3000
))
tdSql
.
checkData
(
1
,
1
,
-
10.0
)
tdSql
.
checkData
(
1
,
2
,
'ct1'
)
tdSql
.
checkData
(
2
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
4000
))
tdSql
.
checkData
(
2
,
1
,
14.0
)
tdSql
.
checkData
(
2
,
2
,
'ct1'
)
tdSql
.
checkData
(
3
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
2000
))
tdSql
.
checkData
(
3
,
1
,
22.0
)
tdSql
.
checkData
(
3
,
2
,
'ct2'
)
tdSql
.
checkData
(
4
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
3000
))
tdSql
.
checkData
(
4
,
1
,
-
110.0
)
tdSql
.
checkData
(
4
,
2
,
'ct2'
)
tdSql
.
checkData
(
5
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
4000
))
tdSql
.
checkData
(
5
,
1
,
154.0
)
tdSql
.
checkData
(
5
,
2
,
'ct2'
)
tdSql
.
query
(
'select diff(c2,0) from st group by tbname'
)
tdSql
.
checkRows
(
6
)
tdSql
.
checkData
(
0
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
1000
))
tdSql
.
checkData
(
0
,
1
,
2.0
)
tdSql
.
checkData
(
0
,
2
,
'ct1'
)
tdSql
.
checkData
(
1
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
3000
))
tdSql
.
checkData
(
1
,
1
,
-
10.0
)
tdSql
.
checkData
(
1
,
2
,
'ct1'
)
tdSql
.
checkData
(
2
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
4000
))
tdSql
.
checkData
(
2
,
1
,
14.0
)
tdSql
.
checkData
(
2
,
2
,
'ct1'
)
tdSql
.
checkData
(
3
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
2000
))
tdSql
.
checkData
(
3
,
1
,
22.0
)
tdSql
.
checkData
(
3
,
2
,
'ct2'
)
tdSql
.
checkData
(
4
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
3000
))
tdSql
.
checkData
(
4
,
1
,
-
110.0
)
tdSql
.
checkData
(
4
,
2
,
'ct2'
)
tdSql
.
checkData
(
5
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
4000
))
tdSql
.
checkData
(
5
,
1
,
154.0
)
tdSql
.
checkData
(
5
,
2
,
'ct2'
)
tdSql
.
query
(
'select diff(c2,1) from st group by tbname'
)
tdSql
.
checkRows
(
4
)
tdSql
.
checkData
(
0
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
1000
))
tdSql
.
checkData
(
0
,
1
,
2.0
)
tdSql
.
checkData
(
0
,
2
,
'ct1'
)
tdSql
.
checkData
(
1
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
4000
))
tdSql
.
checkData
(
1
,
1
,
4.0
)
tdSql
.
checkData
(
1
,
2
,
'ct1'
)
tdSql
.
checkData
(
2
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
2000
))
tdSql
.
checkData
(
2
,
1
,
22.0
)
tdSql
.
checkData
(
2
,
2
,
'ct2'
)
tdSql
.
checkData
(
3
,
0
,
datetime
.
datetime
(
2022
,
1
,
20
,
15
,
10
,
22
,
4000
))
tdSql
.
checkData
(
3
,
1
,
44.0
)
tdSql
.
checkData
(
3
,
2
,
'ct2'
)
tdSql
.
execute
(
'drop database diffneg'
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/develop-test/fulltest-query.sh
浏览文件 @
808e47d2
...
...
@@ -7,3 +7,4 @@ python3 ./test.py -f 2-query/ts_2016.py
python3 ./test.py
-f
2-query/function_mavg.py
python3 ./test.py
-f
2-query/escape.py
python3 ./test.py
-f
2-query/func_compare.py
python3 ./test.py
-f
2-query/diff_ignore_negative.py
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录