Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c2fcab0a
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看板
提交
c2fcab0a
编写于
6月 07, 2021
作者:
haoranc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-4312]<test>: add testcase of nested query with interval function
上级
ac503cc7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
219 addition
and
0 deletion
+219
-0
tests/pytest/query/nestedQuery/insertData.json
tests/pytest/query/nestedQuery/insertData.json
+62
-0
tests/pytest/query/nestedQuery/nestedQueryJson.py
tests/pytest/query/nestedQuery/nestedQueryJson.py
+81
-0
tests/pytest/query/nestedQuery/queryInterval.py
tests/pytest/query/nestedQuery/queryInterval.py
+76
-0
未找到文件。
tests/pytest/query/nestedQuery/insertData.json
0 → 100644
浏览文件 @
c2fcab0a
{
"filetype"
:
"insert"
,
"cfgdir"
:
"/etc/taos"
,
"host"
:
"127.0.0.1"
,
"port"
:
6030
,
"user"
:
"root"
,
"password"
:
"taosdata"
,
"thread_count"
:
4
,
"thread_count_create_tbl"
:
4
,
"result_file"
:
"./insert_res.txt"
,
"confirm_parameter_prompt"
:
"no"
,
"insert_interval"
:
0
,
"interlace_rows"
:
10
,
"num_of_records_per_req"
:
1000
,
"max_sql_len"
:
1024000
,
"databases"
:
[{
"dbinfo"
:
{
"name"
:
"db"
,
"drop"
:
"yes"
,
"replica"
:
1
,
"days"
:
10
,
"cache"
:
50
,
"blocks"
:
8
,
"precision"
:
"ms"
,
"keep"
:
365
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
"walLevel"
:
1
,
"cachelast"
:
0
,
"quorum"
:
1
,
"fsync"
:
3000
,
"update"
:
0
},
"super_tables"
:
[{
"name"
:
"stb0"
,
"child_table_exists"
:
"no"
,
"childtable_count"
:
1
,
"childtable_prefix"
:
"stb0_"
,
"auto_create_table"
:
"no"
,
"batch_create_tbl_num"
:
10
,
"data_source"
:
"rand"
,
"insert_mode"
:
"taosc"
,
"insert_rows"
:
100000
,
"childtable_limit"
:
-1
,
"childtable_offset"
:
0
,
"multi_thread_write_one_tbl"
:
"no"
,
"interlace_rows"
:
0
,
"insert_interval"
:
0
,
"max_sql_len"
:
1024000
,
"disorder_ratio"
:
0
,
"disorder_range"
:
1
,
"timestamp_step"
:
1000
,
"start_timestamp"
:
"2020-10-01 00:00:00.000"
,
"sample_format"
:
"csv"
,
"sample_file"
:
"./tools/taosdemoAllTest/sample.csv"
,
"tags_file"
:
""
,
"columns"
:
[{
"type"
:
"INT"
,
"count"
:
1
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
1
},
{
"type"
:
"BOOL"
}],
"tags"
:
[{
"type"
:
"TINYINT"
,
"count"
:
1
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
1
}]
}]
}]
}
tests/pytest/query/nestedQuery/nestedQueryJson.py
0 → 100644
浏览文件 @
c2fcab0a
###################################################################
# 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
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
return
buildPath
def
run
(
self
):
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
# insert: create one or mutiple tables per sql and insert multiple rows per sql
os
.
system
(
"%staosdemo -f query/nestedQuery/insertData.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
tdSql
.
query
(
"select count(*) from stb00_0"
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
100000
)
tdSql
.
query
(
"select count(*) from stb01_1"
)
tdSql
.
checkData
(
0
,
0
,
200
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
200000
)
testcaseFilename
=
os
.
path
.
split
(
__file__
)[
-
1
]
os
.
system
(
"rm -rf ./insert_res.txt"
)
os
.
system
(
"rm -rf query/nestedQuery/%s.sql"
%
testcaseFilename
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/query/nestedQuery/queryInterval.py
0 → 100644
浏览文件 @
c2fcab0a
###################################################################
# 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
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
.
ts1
=
1593548685000
self
.
ts2
=
1593548785000
def
run
(
self
):
# tdSql.execute("drop database db ")
tdSql
.
prepare
()
tdSql
.
execute
(
"create table st (ts timestamp, num int, value int , t_instance int) tags (loc nchar(30))"
)
number
=
20
for
n
in
range
(
number
):
dt
=
n
*
300000
# collecting'frequency is 10s
args1
=
(
self
.
ts1
+
dt
,
n
,
100
+
n
,
10
+
n
)
args2
=
(
self
.
ts2
+
dt
,
n
,
120
+
n
,
15
+
n
)
tdSql
.
execute
(
"insert into t0 using st tags('beijing') values(%d, %d, %d, %d)"
%
args1
)
tdSql
.
execute
(
"insert into t1 using st tags('shanghai') values(%d, %d, %d, %d)"
%
args2
)
tdSql
.
query
(
"select avg(value) from st interval(10m)"
)
print
(
tdSql
.
queryResult
)
tdSql
.
checkRows
(
11
)
tdSql
.
checkData
(
0
,
0
,
"2020-07-01 04:20:00"
)
tdSql
.
query
(
"select avg_val from(select avg(value) as avg_val from st where loc='beijing' interval(10m));"
)
# tdSql.query("select avg(avg_val) from(select avg(value) as avg_val from st where loc='beijing' interval(10m));")
print
(
tdSql
.
queryResult
)
tdSql
.
checkData
(
0
,
0
,
109.5
)
# tdSql.query("select avg(voltage) from st interval(1n, 15d)")
# tdSql.query("select avg(voltage) from st interval(1n, 15d) group by loc")
# tdDnodes.stop(1)
# tdDnodes.start(1)
# tdSql.query("select last(*) from t interval(1s)")
# tdSql.query("select first(ts),twa(c) from tb interval(14a)")
# tdSql.checkRows(6)
# tdSql.query("select twa(c) from tb group by c")
# tdSql.checkRows(4)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录