Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
哥们要飞
TDengine
提交
a880f579
T
TDengine
项目概览
哥们要飞
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a880f579
编写于
12月 10, 2020
作者:
L
liuyq-617
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test Jenkins
上级
f81a57df
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
35 addition
and
36 deletion
+35
-36
tests/pytest/concurrent_inquiry.py
tests/pytest/concurrent_inquiry.py
+35
-36
未找到文件。
tests/pytest/concurrent_inquiry.py
浏览文件 @
a880f579
...
...
@@ -189,51 +189,50 @@ class ConcurrentInquiry:
return
sql
def
gen_query_join
(
self
):
#生成join查询语句
tbi
=
random
.
randint
(
0
,
len
(
self
.
subtb_list
)
+
len
(
self
.
stb_list
))
#随机决定查询哪张表
tbname
=
''
col_list
=
[]
tag_list
=
[]
is_stb
=
0
if
tbi
>
len
(
self
.
stb_list
)
:
tbi
=
tbi
-
len
(
self
.
stb_list
)
tbname
=
self
.
subtb_list
[
tbi
-
1
]
col_list
=
self
.
subtb_stru_list
[
tbi
-
1
]
tag_list
=
self
.
subtb_tag_list
[
tbi
-
1
]
tbname
=
[]
col_list
=
[]
tag_list
=
[]
col_intersection
=
[]
tag_intersection
=
[]
if
bool
(
random
.
getrandbits
(
1
)):
tbname
=
random
.
sample
(
self
.
subtb_list
,
2
)
for
i
in
tbname
:
col_list
.
append
(
self
.
subtb_stru_list
[
self
.
subtb_list
.
index
(
i
)])
tag_list
.
append
(
self
.
subtb_stru_list
[
self
.
subtb_list
.
index
(
i
)])
col_intersection
=
list
(
set
(
col_list
[
0
]).
intersection
(
set
(
col_list
[
1
])))
tag_intersection
=
list
(
set
(
tag_list
[
0
]).
intersection
(
set
(
tag_list
[
1
])))
else
:
tbname
=
self
.
stb_list
[
tbi
-
1
]
col_list
=
self
.
stb_stru_list
[
tbi
-
1
]
tag_list
=
self
.
stb_tag_list
[
tbi
-
1
]
is_stb
=
1
tlist
=
col_list
+
tag_list
+
[
'abc'
]
#增加不存在的域'abc',是否会引起新bug
tbname
=
random
.
sample
(
self
.
stb_list
,
2
)
for
i
in
tbname
:
col_list
.
append
(
self
.
stb_stru_list
[
self
.
stb_list
.
index
(
i
)])
tag_list
.
append
(
self
.
stb_stru_list
[
self
.
stb_list
.
index
(
i
)])
col_intersection
=
list
(
set
(
col_list
[
0
]).
intersection
(
set
(
col_list
[
1
])))
tag_intersection
=
list
(
set
(
tag_list
[
0
]).
intersection
(
set
(
tag_list
[
1
])))
con_rand
=
random
.
randint
(
0
,
len
(
condition_list
))
func_rand
=
random
.
randint
(
0
,
len
(
func_list
))
col_rand
=
random
.
randint
(
0
,
len
(
col_list
))
tag_rand
=
random
.
randint
(
0
,
len
(
tag_list
))
t_rand
=
random
.
randint
(
0
,
len
(
tlist
))
sql
=
'select '
#select
random
.
shuffle
(
col_list
)
random
.
shuffle
(
func_list
)
sel_col_list
=
[]
sel_col_tag
=
[]
col_rand
=
random
.
randint
(
0
,
len
(
col_list
))
for
i
,
j
in
zip
(
col_list
[
0
:
col_rand
],
func_list
):
#决定每个被查询col的函数
alias
=
'as '
+
str
(
i
)
pick_func
=
''
if
j
==
'leastsquares'
:
pick_func
=
j
+
'('
+
i
+
',1,1)'
elif
j
==
'top'
or
j
==
'bottom'
or
j
==
'percentile'
or
j
==
'apercentile'
:
pick_func
=
j
+
'('
+
i
+
',1)'
else
:
pick_func
=
j
+
'('
+
i
+
')'
if
bool
(
random
.
getrandbits
(
1
)):
pick_func
+=
alias
sel_col_list
.
append
(
pick_func
)
sql
=
sql
+
','
.
join
(
sel_col_list
)
+
' from '
+
random
.
choice
(
self
.
stb_list
+
self
.
subtb_list
)
+
' '
#select col & func
if
bool
(
random
.
getrandbits
(
1
)):
sql
+=
'*'
else
:
sel_col_tag
.
append
(
't1.'
+
str
(
random
.
choice
(
col_list
[
0
]
+
tag_list
[
0
])))
sel_col_tag
.
append
(
't2.'
+
str
(
random
.
choice
(
col_list
[
1
]
+
tag_list
[
1
])))
sql
+=
','
.
join
(
sel_col_tag
)
sql
=
sql
+
'from '
+
','
.
join
(
tbname
)
+
' '
#select col & func
con_func
=
[
self
.
con_where
,
self
.
con_interval
,
self
.
con_limit
,
self
.
con_group
,
self
.
con_order
,
self
.
con_fill
]
sel_con
=
random
.
sample
(
con_func
,
random
.
randint
(
0
,
len
(
con_func
)))
sel_con_list
=
[]
for
i
in
sel_con
:
sel_con_list
.
append
(
i
(
tlist
,
col_list
,
tag_list
))
#获取对应的条件函数
#
for i in sel_con:
#
sel_con_list.append(i(tlist,col_list,tag_list)) #获取对应的条件函数
sql
+=
' '
.
join
(
sel_con_list
)
# condition
print
(
sql
)
return
sql
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录