Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
18df0e37
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
18df0e37
编写于
7月 05, 2021
作者:
P
Ping Xiao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-5000]<test>: add test case for nested query
上级
4e943302
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
91 addition
and
1 deletion
+91
-1
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+1
-0
tests/pytest/query/nestedQuery/queryWithOrderLimit.py
tests/pytest/query/nestedQuery/queryWithOrderLimit.py
+79
-0
tests/pytest/query/queryPerformance.py
tests/pytest/query/queryPerformance.py
+11
-1
未找到文件。
tests/pytest/fulltest.sh
浏览文件 @
18df0e37
...
...
@@ -238,6 +238,7 @@ python3 ./test.py -f query/queryTsisNull.py
python3 ./test.py
-f
query/subqueryFilter.py
# python3 ./test.py -f query/nestedQuery/queryInterval.py
python3 ./test.py
-f
query/queryStateWindow.py
python3 ./test.py
-f
query/nestedQuery/queryWithOrderLimit.py
#stream
...
...
tests/pytest/query/nestedQuery/queryWithOrderLimit.py
0 → 100644
浏览文件 @
18df0e37
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
os
import
taos
from
util.log
import
tdLog
from
util.cases
import
tdCases
from
util.sql
import
tdSql
from
util.dnodes
import
tdDnodes
import
random
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
ts
=
1593548685000
self
.
tables
=
10
self
.
rowsPerTable
=
100
def
run
(
self
):
# tdSql.execute("drop database db ")
tdSql
.
prepare
()
tdSql
.
execute
(
"create table st (ts timestamp, num int, value int) tags (loc nchar(30))"
)
for
i
in
range
(
self
.
tables
):
for
j
in
range
(
self
.
rowsPerTable
):
args1
=
(
i
,
i
,
self
.
ts
+
i
*
self
.
rowsPerTable
+
j
*
10000
,
i
,
random
.
randint
(
1
,
100
))
tdSql
.
execute
(
"insert into t%d using st tags('beijing%d') values(%d, %d, %d)"
%
args1
)
tdSql
.
query
(
"select * from (select * from st)"
)
tdSql
.
checkRows
(
self
.
tables
*
self
.
rowsPerTable
)
tdSql
.
query
(
"select * from (select * from st limit 10)"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select * from (select * from st order by ts desc limit 10)"
)
tdSql
.
checkRows
(
10
)
# bug: https://jira.taosdata.com:18080/browse/TD-5043
# tdSql.query("select * from (select * from st order by ts desc limit 10 offset 1000)")
# tdSql.checkRows(0)
tdSql
.
query
(
"select avg(value), sum(value) from st group by tbname"
)
tdSql
.
checkRows
(
self
.
tables
)
tdSql
.
query
(
"select * from (select avg(value), sum(value) from st group by tbname)"
)
tdSql
.
checkRows
(
self
.
tables
)
tdSql
.
query
(
"select avg(value), sum(value) from st group by tbname slimit 5"
)
tdSql
.
checkRows
(
5
)
tdSql
.
query
(
"select * from (select avg(value), sum(value) from st group by tbname slimit 5)"
)
tdSql
.
checkRows
(
5
)
tdSql
.
query
(
"select avg(value), sum(value) from st group by tbname slimit 5 soffset 7"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select * from (select avg(value), sum(value) from st group by tbname slimit 5 soffset 7)"
)
tdSql
.
checkRows
(
3
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/query/queryPerformance.py
浏览文件 @
18df0e37
...
...
@@ -45,28 +45,38 @@ class taosdemoQueryPerformace:
sql
=
"select count(*) from test.meters"
tableid
=
1
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
sql
=
"select avg(f1), max(f2), min(f3) from test.meters"
tableid
=
2
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
sql
=
"select count(*) from test.meters where loc='beijing'"
tableid
=
3
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d,
\"
%s
\"
)"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
sql
=
"select avg(f1), max(f2), min(f3) from test.meters where areaid=10"
tableid
=
4
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
sql
=
"select avg(f1), max(f2), min(f3) from test.t10 interval(10s)"
tableid
=
5
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
sql
=
"select last_row(*) from meters"
tableid
=
6
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
sql
=
"select * from meters"
tableid
=
7
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
sql
=
"select avg(f1), max(f2), min(f3) from meters where ts <= '2017-07-15 10:40:01.000' and ts <= '2017-07-15 14:00:40.000'"
tableid
=
8
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d,
\"
%s
\"
)"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
sql
=
"select last(*) from meters"
tableid
=
9
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
cursor
.
close
()
def
query
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录