Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d441dee5
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
未验证
提交
d441dee5
编写于
7月 05, 2021
作者:
H
Hui Li
提交者:
GitHub
7月 05, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6743 from taosdata/xiaoping/add_test_case
[TD-5000]<test>: add test case for nested query
上级
2d79c55e
18df0e37
变更
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
浏览文件 @
d441dee5
...
@@ -238,6 +238,7 @@ python3 ./test.py -f query/queryTsisNull.py
...
@@ -238,6 +238,7 @@ python3 ./test.py -f query/queryTsisNull.py
python3 ./test.py
-f
query/subqueryFilter.py
python3 ./test.py
-f
query/subqueryFilter.py
# python3 ./test.py -f query/nestedQuery/queryInterval.py
# python3 ./test.py -f query/nestedQuery/queryInterval.py
python3 ./test.py
-f
query/queryStateWindow.py
python3 ./test.py
-f
query/queryStateWindow.py
python3 ./test.py
-f
query/nestedQuery/queryWithOrderLimit.py
#stream
#stream
...
...
tests/pytest/query/nestedQuery/queryWithOrderLimit.py
0 → 100644
浏览文件 @
d441dee5
###################################################################
# 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
浏览文件 @
d441dee5
...
@@ -45,28 +45,38 @@ class taosdemoQueryPerformace:
...
@@ -45,28 +45,38 @@ class taosdemoQueryPerformace:
sql
=
"select count(*) from test.meters"
sql
=
"select count(*) from test.meters"
tableid
=
1
tableid
=
1
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
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"
sql
=
"select avg(f1), max(f2), min(f3) from test.meters"
tableid
=
2
tableid
=
2
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
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'"
sql
=
"select count(*) from test.meters where loc='beijing'"
tableid
=
3
tableid
=
3
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d,
\"
%s
\"
)"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
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"
sql
=
"select avg(f1), max(f2), min(f3) from test.meters where areaid=10"
tableid
=
4
tableid
=
4
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
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)"
sql
=
"select avg(f1), max(f2), min(f3) from test.t10 interval(10s)"
tableid
=
5
tableid
=
5
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
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"
sql
=
"select last_row(*) from meters"
tableid
=
6
tableid
=
6
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
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"
sql
=
"select * from meters"
tableid
=
7
tableid
=
7
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
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'"
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
tableid
=
8
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d,
\"
%s
\"
)"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
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
()
cursor
.
close
()
def
query
(
self
):
def
query
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录