Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
dd0a6b0a
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
dd0a6b0a
编写于
5月 26, 2022
作者:
J
jiacy-jcy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add test case for bottom and top
上级
6361e877
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
115 deletion
+28
-115
tests/system-test/2-query/bottom.py
tests/system-test/2-query/bottom.py
+15
-55
tests/system-test/2-query/top.py
tests/system-test/2-query/top.py
+13
-60
未找到文件。
tests/system-test/2-query/bottom.py
浏览文件 @
dd0a6b0a
...
...
@@ -55,84 +55,44 @@ class TDTestCase:
tdSql
.
query
(
"select bottom(col1, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
,[(
2
,),(
1
,)])
tdSql
.
query
(
"select bottom(col2, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
,[(
2
,),(
1
,)])
tdSql
.
query
(
"select bottom(col3, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
,[(
2
,),(
1
,)])
tdSql
.
query
(
"select bottom(col4, 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
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
0.1
)
tdSql
.
checkData
(
1
,
1
,
1.1
)
tdSql
.
query
(
"select bottom(col6, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
0.1
)
tdSql
.
checkData
(
1
,
1
,
1.1
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
,[(
2
,),(
1
,)])
tdSql
.
query
(
"select bottom(col11, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
,[(
2
,),(
1
,)])
tdSql
.
query
(
"select bottom(col12, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
,[(
2
,),(
1
,)])
tdSql
.
query
(
"select bottom(col13, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
,[(
2
,),(
1
,)])
tdSql
.
query
(
"select bottom(col14, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
query
(
"select ts,bottom(col1, 2),ts from test1"
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
,[(
2
,),(
1
,)])
tdSql
.
query
(
"select ts,bottom(col1, 2) from test1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
"2018-09-17 09:00:00.000"
)
tdSql
.
checkData
(
0
,
1
,
"2018-09-17 09:00:00.000"
)
tdSql
.
checkData
(
1
,
0
,
"2018-09-17 09:00:00.001"
)
tdSql
.
checkData
(
1
,
3
,
"2018-09-17 09:00:00.001"
)
tdSql
.
query
(
"select ts,bottom(col1, 2),ts from test group by tbname"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
"2018-09-17 09:00:00.000"
)
tdSql
.
checkData
(
0
,
1
,
"2018-09-17 09:00:00.000"
)
tdSql
.
checkData
(
1
,
0
,
"2018-09-17 09:00:00.001"
)
tdSql
.
checkData
(
1
,
3
,
"2018-09-17 09:00:00.001"
)
#TD-2457 bottom + interval + order by
tdSql
.
error
(
'select top(col2,1) from test interval(1y) order by col2;'
)
#TD-2563 top + super_table + interval
tdSql
.
execute
(
"create table meters(ts timestamp, c int) tags (d int)"
)
tdSql
.
execute
(
"create table t1 using meters tags (1)"
)
sql
=
'insert into t1 values '
for
i
in
range
(
20000
):
sql
=
sql
+
'(%d, %d)'
%
(
self
.
ts
+
i
,
i
%
47
)
if
i
%
2000
==
0
:
tdSql
.
execute
(
sql
)
sql
=
'insert into t1 values '
tdSql
.
execute
(
sql
)
tdSql
.
query
(
'select bottom(c,1) from meters interval(10a)'
)
tdSql
.
checkData
(
0
,
1
,
0
)
tdSql
.
query
(
'select bottom(col2,1) from test interval(1y) order by col2'
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
error
(
'select * from test where bottom(col2,1)=1'
)
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/system-test/2-query/top.py
浏览文件 @
dd0a6b0a
...
...
@@ -27,8 +27,7 @@ class TDTestCase:
def
run
(
self
):
tdSql
.
prepare
()
intData
=
[]
floatData
=
[]
tdSql
.
execute
(
'''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))'''
)
...
...
@@ -36,8 +35,7 @@ class TDTestCase:
for
i
in
range
(
self
.
rowNum
):
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
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
))
intData
.
append
(
i
+
1
)
floatData
.
append
(
i
+
0.1
)
# top verifacation
tdSql
.
error
(
"select top(ts, 10) from test"
)
...
...
@@ -67,82 +65,37 @@ class TDTestCase:
tdSql
.
query
(
"select top(col1, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
9
)
tdSql
.
checkData
(
1
,
1
,
10
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
,[(
9
,),(
10
,)])
tdSql
.
query
(
"select top(col2, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
9
)
tdSql
.
checkData
(
1
,
1
,
10
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
,[(
9
,),(
10
,)])
tdSql
.
query
(
"select top(col3, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
9
)
tdSql
.
checkData
(
1
,
1
,
10
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
,[(
9
,),(
10
,)])
tdSql
.
query
(
"select top(col4, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
9
)
tdSql
.
checkData
(
1
,
1
,
10
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
,[(
9
,),(
10
,)])
tdSql
.
query
(
"select top(col11, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
9
)
tdSql
.
checkData
(
1
,
1
,
10
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
,[(
9
,),(
10
,)])
tdSql
.
query
(
"select top(col12, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
9
)
tdSql
.
checkData
(
1
,
1
,
10
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
,[(
9
,),(
10
,)])
tdSql
.
query
(
"select top(col13, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
9
)
tdSql
.
checkData
(
1
,
1
,
10
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
,[(
9
,),(
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
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
8.1
)
tdSql
.
checkData
(
1
,
1
,
9.1
)
tdSql
.
query
(
"select top(col6, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
8.1
)
tdSql
.
checkData
(
1
,
1
,
9.1
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
,[(
9
,),(
10
,)])
tdSql
.
query
(
"select ts,top(col1, 2),ts from test1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
"2018-09-17 09:00:00.008"
)
tdSql
.
checkData
(
0
,
1
,
"2018-09-17 09:00:00.008"
)
tdSql
.
checkData
(
1
,
0
,
"2018-09-17 09:00:00.009"
)
tdSql
.
checkData
(
1
,
3
,
"2018-09-17 09:00:00.009"
)
tdSql
.
query
(
"select ts,top(col1, 2),ts from test group by tbname"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
"2018-09-17 09:00:00.008"
)
tdSql
.
checkData
(
0
,
1
,
"2018-09-17 09:00:00.008"
)
tdSql
.
checkData
(
1
,
0
,
"2018-09-17 09:00:00.009"
)
tdSql
.
checkData
(
1
,
3
,
"2018-09-17 09:00:00.009"
)
#TD-2563 top + super_table + interval
tdSql
.
execute
(
"create table meters(ts timestamp, c int) tags (d int)"
)
tdSql
.
execute
(
"create table t1 using meters tags (1)"
)
sql
=
'insert into t1 values '
for
i
in
range
(
20000
):
sql
=
sql
+
'(%d, %d)'
%
(
self
.
ts
+
i
,
i
%
47
)
if
i
%
2000
==
0
:
tdSql
.
execute
(
sql
)
sql
=
'insert into t1 values '
tdSql
.
execute
(
sql
)
tdSql
.
query
(
'select top(c,1) from meters interval(10a)'
)
tdSql
.
checkData
(
0
,
1
,
9
)
tdSql
.
query
(
'select top(col2,1) from test interval(1y) order by col2'
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
error
(
'select * from test where bottom(col2,1)=1'
)
def
stop
(
self
):
tdSql
.
close
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录