Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4255a689
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
4255a689
编写于
6月 21, 2022
作者:
W
wenzhouwww@live.cn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
2e308b60
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
12 addition
and
30 deletion
+12
-30
tests/system-test/2-query/twa.py
tests/system-test/2-query/twa.py
+12
-30
未找到文件。
tests/system-test/2-query/twa.py
浏览文件 @
4255a689
...
...
@@ -21,33 +21,6 @@ class TDTestCase:
self
.
row_nums
=
100
self
.
time_step
=
1000
def
check_stddev_functions
(
self
,
tbname
,
col_name
):
stddev_sql
=
f
"select stddev(
{
col_name
}
) from
{
tbname
}
;"
same_sql
=
f
"select
{
col_name
}
from
{
tbname
}
where
{
col_name
}
is not null "
tdSql
.
query
(
same_sql
)
pre_data
=
np
.
array
(
tdSql
.
queryResult
)[
np
.
array
(
tdSql
.
queryResult
)
!=
None
]
if
(
platform
.
system
().
lower
()
==
'windows'
and
pre_data
.
dtype
==
'int32'
):
pre_data
=
np
.
array
(
pre_data
,
dtype
=
'int64'
)
pre_avg
=
np
.
sum
(
pre_data
)
/
len
(
pre_data
)
# Calculate variance
stddev_result
=
0
for
num
in
tdSql
.
queryResult
:
stddev_result
+=
(
num
-
pre_avg
)
*
(
num
-
pre_avg
)
/
len
(
tdSql
.
queryResult
)
stddev_result
=
math
.
sqrt
(
stddev_result
)
tdSql
.
query
(
stddev_sql
)
if
-
0.0001
<
tdSql
.
queryResult
[
0
][
0
]
-
stddev_result
<
0.0001
:
tdLog
.
info
(
" sql:%s; row:0 col:0 data:%d , expect:%d"
%
(
stddev_sql
,
tdSql
.
queryResult
[
0
][
0
],
stddev_result
))
else
:
tdLog
.
exit
(
" sql:%s; row:0 col:0 data:%d , expect:%d"
%
(
stddev_sql
,
tdSql
.
queryResult
[
0
][
0
],
stddev_result
))
def
prepare_datas_of_distribute
(
self
):
# prepate datas for 20 tables distributed at different vgroups
...
...
@@ -75,6 +48,16 @@ class TDTestCase:
tdLog
.
info
(
" prepare data for distributed_aggregate done! "
)
def
twa_support_types
(
self
):
tdSql
.
query
(
"desc stb1 "
)
schema_list
=
tdSql
.
queryResult
for
col_type
in
schema_list
:
if
col_type
[
1
]
in
[
"TINYINT"
,
"SMALLINT"
,
"BIGINT"
,
"INT"
,
"FLOAT"
,
"DOUBLE"
]:
tdSql
.
query
(
f
" select twa(
{
col_type
[
0
]
}
) from stb1 partition by tbname "
)
else
:
tdSql
.
error
(
f
" select twa(
{
col_type
[
0
]
}
) from stb1 partition by tbname "
)
def
check_distribute_datas
(
self
):
# get vgroup_ids of all
tdSql
.
query
(
"show vgroups "
)
...
...
@@ -85,7 +68,6 @@ class TDTestCase:
for
vgroup_id
in
vgroups
:
vnode_tables
[
vgroup_id
[
0
]]
=
[]
# check sub_table of per vnode ,make sure sub_table has been distributed
tdSql
.
query
(
"show tables like 'ct%'"
)
table_names
=
tdSql
.
queryResult
...
...
@@ -157,9 +139,9 @@ class TDTestCase:
def
run
(
self
):
self
.
prepare_datas_of_distribute
()
self
.
check_distribute_datas
()
self
.
twa_support_types
()
self
.
distribute_twa_query
()
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录