Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
39e90241
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看板
提交
39e90241
编写于
5月 07, 2022
作者:
C
cpwu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix case
上级
74ce0b61
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
42 addition
and
30 deletion
+42
-30
tests/system-test/2-query/concat.py
tests/system-test/2-query/concat.py
+42
-30
未找到文件。
tests/system-test/2-query/concat.py
浏览文件 @
39e90241
from
pyparsing
import
nums
from
util.log
import
*
from
util.sql
import
*
from
util.cases
import
*
...
...
@@ -68,70 +69,79 @@ class TDTestCase:
def
__group_condition
(
self
,
col
,
having
=
""
):
return
f
" group by
{
col
}
having
{
having
}
"
if
having
else
f
" group by
{
col
}
"
def
__concat_c
urrent_c
heck
(
self
,
tbname
,
num
):
def
__concat_check
(
self
,
tbname
,
num
):
concat_condition
=
self
.
__concat_condition
()
for
i
in
range
(
len
(
concat_condition
)
-
num
+
1
):
condition
=
self
.
__concat_num
(
concat_condition
[
i
:],
num
)
concat_filter
=
f
"concat(
{
','
.
join
(
condition
)
}
)"
where_condition
=
self
.
__where_condition
(
condition
[
0
])
group_having
=
self
.
__group_condition
(
condition
[
0
],
having
=
f
"
{
condition
[
0
]
}
is not null "
)
concat_group_having
=
self
.
__group_condition
(
concat_filter
,
having
=
f
"
{
concat_filter
}
is not null "
)
group_no_having
=
self
.
__group_condition
(
condition
[
0
]
)
concat_group_no_having
=
self
.
__group_condition
(
concat_filter
)
groups
=
[
""
,
group_having
,
group_no_having
]
concat_groups
=
[
""
,
concat_group_having
,
concat_group_no_having
]
for
n
in
range
(
len
(
groups
)):
tdSql
.
query
(
f
"select
{
','
.
join
(
condition
)
}
from
{
tbname
}
{
where_condition
}
{
groups
[
n
]
}
"
)
rows
=
tdSql
.
queryRows
concat_data
=
[]
for
m
in
range
(
rows
):
concat_data
.
append
(
""
.
join
(
tdSql
.
queryResult
[
m
]))
if
tdSql
.
getData
(
m
,
0
)
else
concat_data
.
append
(
None
)
tdSql
.
query
(
f
"select concat(
{
','
.
join
(
condition
)
}
) from
{
tbname
}
{
where_condition
}
{
concat_groups
[
n
]
}
"
)
tdSql
.
checkRows
(
rows
)
for
j
in
range
(
tdSql
.
queryRows
):
assert
tdSql
.
getData
(
j
,
0
)
in
concat_data
if
num
>
8
or
num
<
2
:
[
tdSql
.
error
(
f
"select concat(
{
','
.
join
(
condition
)
}
) from
{
tbname
}
{
where_condition
}
{
group
}
"
)
for
group
in
groups
]
tdSql
.
query
(
f
"select
{
','
.
join
(
condition
)
}
from
{
tbname
}
"
)
rows
=
tdSql
.
queryRows
concat_data
=
[]
for
m
in
range
(
rows
):
concat_data
.
append
(
""
.
join
(
tdSql
.
queryResult
[
m
]))
if
tdSql
.
getData
(
m
,
0
)
else
concat_data
.
append
(
None
)
tdSql
.
query
(
f
"select concat(
{
','
.
join
(
condition
)
}
) from
{
tbname
}
"
)
tdSql
.
checkRows
(
rows
)
for
j
in
range
(
tdSql
.
queryRows
):
assert
tdSql
.
getData
(
j
,
0
)
in
concat_data
[
tdSql
.
query
(
f
"select concat(
{
','
.
join
(
condition
)
}
) from
{
tbname
}
{
where_condition
}
{
group
}
"
)
for
group
in
groups
]
def
__concat_err_check
(
self
,
tbname
):
sqls
=
[]
for
un_char_col
in
NUM
_COL
:
for
char_col
in
CHAR
_COL
:
sqls
.
extend
(
(
f
"select concat(
{
un_
char_col
}
) from
{
tbname
}
"
,
f
"select concat(ceil(
{
un_
char_col
}
)) from
{
tbname
}
"
,
f
"select
{
un_char_col
}
from
{
tbname
}
group by concat(
{
un_
char_col
}
) "
,
f
"select concat(
{
char_col
}
) from
{
tbname
}
"
,
f
"select concat(ceil(
{
char_col
}
)) from
{
tbname
}
"
,
f
"select
{
char_col
}
from
{
tbname
}
group by concat(
{
char_col
}
) "
,
)
)
sqls
.
extend
(
f
"select concat(
{
un_char_col
}
+
{
un_char_col_2
}
) from
{
tbname
}
"
for
un_char_col_2
in
NUM_COL
)
sqls
.
extend
(
f
"select concat(
{
un_char_col
}
+
{
ts_col
}
) from
{
tbname
}
"
for
ts_col
in
TS_TYPE_COL
)
sqls
.
extend
(
f
"select concat(
{
char_col
}
,
{
num_col
}
) from
{
tbname
}
"
for
num_col
in
NUM_COL
)
sqls
.
extend
(
f
"select concat(
{
char_col
}
,
{
ts_col
}
) from
{
tbname
}
"
for
ts_col
in
TS_TYPE_COL
)
sqls
.
extend
(
f
"select concat(
{
char_col
}
,
{
bool_col
}
) from
{
tbname
}
"
for
bool_col
in
BOOLEAN_COL
)
sqls
.
extend
(
f
"select concat(
{
ts_col
}
,
{
bool_col
}
) from
{
tbname
}
"
for
ts_col
in
TS_TYPE_COL
for
bool_col
in
BOOLEAN_COL
)
sqls
.
extend
(
f
"select concat(
{
num_col
}
,
{
ts_col
}
) from
{
tbname
}
"
for
num_col
in
NUM_COL
for
ts_col
in
TS_TYPE_COL
)
sqls
.
extend
(
f
"select concat(
{
num_col
}
,
{
bool_col
}
) from
{
tbname
}
"
for
num_col
in
NUM_COL
for
bool_col
in
BOOLEAN_COL
)
sqls
.
extend
(
f
"select concat(
{
num_col
}
,
{
num_col
}
) from
{
tbname
}
"
for
num_col
in
NUM_COL
for
num_col
in
NUM_COL
)
sqls
.
extend
(
f
"select concat(
{
ts_col
}
,
{
ts_col
}
) from
{
tbname
}
"
for
ts_col
in
TS_TYPE_COL
for
ts_col
in
TS_TYPE_COL
)
sqls
.
extend
(
f
"select concat(
{
bool_col
}
,
{
bool_col
}
) from
{
tbname
}
"
for
bool_col
in
BOOLEAN_COL
for
bool_col
in
BOOLEAN_COL
)
sqls
.
extend
(
f
"select
{
char_col
}
from
{
tbname
}
group by concat(
{
char_col
}
) "
for
char_col
in
CHAR_COL
)
sqls
.
extend
(
f
"select concat(
{
ts_col
}
) from
{
tbname
}
"
for
ts_col
in
TS_TYPE_COL
)
sqls
.
extend
(
f
"select concat(
{
char_col
}
+
{
ts_col
}
) from
{
tbname
}
"
for
char_col
in
NUM_COL
for
ts_col
in
TS_TYPE_COL
)
sqls
.
extend
(
f
"select concat(
{
char_col
}
+
{
char_col_2
}
) from
{
tbname
}
"
for
char_col
in
CHAR_COL
for
char_col_2
in
CHAR_COL
)
sqls
.
extend
(
f
"select upper(
{
char_col
}
, 11) from
{
tbname
}
"
for
char_col
in
CHAR_COL
)
sqls
.
extend
(
f
"select upper(
{
char_col
}
) from
{
tbname
}
interval(2d) sliding(1d)"
for
char_col
in
CHAR_COL
)
sqls
.
extend
(
f
"select concat(
{
char_col
}
, 11) from
{
tbname
}
"
for
char_col
in
CHAR_COL
)
sqls
.
extend
(
f
"select concat(
{
num_col
}
, '1') from
{
tbname
}
"
for
num_col
in
NUM_COL
)
sqls
.
extend
(
f
"select concat(
{
ts_col
}
, '1') from
{
tbname
}
"
for
ts_col
in
TS_TYPE_COL
)
sqls
.
extend
(
f
"select concat(
{
bool_col
}
, '1') from
{
tbname
}
"
for
bool_col
in
BOOLEAN_COL
)
sqls
.
extend
(
f
"select concat(
{
char_col
}
,'1') from
{
tbname
}
interval(2d) sliding(1d)"
for
char_col
in
CHAR_COL
)
sqls
.
extend
(
(
f
"select concat() from
{
tbname
}
"
,
f
"select concat(*) from
{
tbname
}
"
,
f
"select concat(ccccccc) from
{
tbname
}
"
,
f
"select concat(111) from
{
tbname
}
"
,
f
"select concat(c8, 11) from
{
tbname
}
"
,
)
)
return
sqls
def
__test_current
(
self
):
def
__test_current
(
self
):
# sourcery skip: use-itertools-product
tdLog
.
printNoPrefix
(
"==========current sql condition check , must return query ok=========="
)
tbname
=
[
"ct1"
,
"ct2"
,
"ct4"
,
"t1"
,
"stb1"
]
for
tb
in
tbname
:
self
.
__concat_current_check
(
tb
,
2
)
tdLog
.
printNoPrefix
(
f
"==========current sql condition check in
{
tb
}
over=========="
)
for
i
in
range
(
2
,
8
):
self
.
__concat_check
(
tb
,
i
)
tdLog
.
printNoPrefix
(
f
"==========current sql condition check in
{
tb
}
, col num:
{
i
}
over=========="
)
def
__test_error
(
self
):
tdLog
.
printNoPrefix
(
"==========err sql condition check , must return error=========="
)
...
...
@@ -140,6 +150,8 @@ class TDTestCase:
for
tb
in
tbname
:
for
errsql
in
self
.
__concat_err_check
(
tb
):
tdSql
.
error
(
sql
=
errsql
)
self
.
__concat_check
(
tb
,
1
)
self
.
__concat_check
(
tb
,
9
)
tdLog
.
printNoPrefix
(
f
"==========err sql condition check in
{
tb
}
over=========="
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录