Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2598bb81
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
2598bb81
编写于
4月 28, 2022
作者:
C
cpwu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix case
上级
1dd478d1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
32 addition
and
32 deletion
+32
-32
tests/system-test/2-query/char_length.py
tests/system-test/2-query/char_length.py
+32
-32
未找到文件。
tests/system-test/2-query/char_length.py
浏览文件 @
2598bb81
...
...
@@ -26,22 +26,22 @@ class TDTestCase:
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdSql
.
init
(
conn
.
cursor
())
def
__length_condition
(
self
):
length_condition
=
[]
def
__
char_char_
length_condition
(
self
):
char_
length_condition
=
[]
for
char_col
in
CHAR_COL
:
length_condition
.
extend
(
char_
length_condition
.
extend
(
(
char_col
,
f
"upper(
{
char_col
}
)"
,
)
)
length_condition
.
extend
(
f
"cast(
{
un_char_col
}
as binary(16) ) "
for
un_char_col
in
UN_CHAR_COL
)
length_condition
.
extend
(
f
"cast(
{
char_col
}
+
{
char_col_2
}
as binary(32) ) "
for
char_col_2
in
CHAR_COL
)
length_condition
.
extend
(
f
"cast(
{
char_col
}
+
{
un_char_col
}
as binary(32) ) "
for
un_char_col
in
UN_CHAR_COL
)
char_
length_condition
.
extend
(
f
"cast(
{
un_char_col
}
as binary(16) ) "
for
un_char_col
in
UN_CHAR_COL
)
char_
length_condition
.
extend
(
f
"cast(
{
char_col
}
+
{
char_col_2
}
as binary(32) ) "
for
char_col_2
in
CHAR_COL
)
char_
length_condition
.
extend
(
f
"cast(
{
char_col
}
+
{
un_char_col
}
as binary(32) ) "
for
un_char_col
in
UN_CHAR_COL
)
length_condition
.
append
(
'''"test1234!@#$%^&*():'><?/.,][}{"'''
)
char_
length_condition
.
append
(
'''"test1234!@#$%^&*():'><?/.,][}{"'''
)
return
length_condition
return
char_
length_condition
def
__where_condition
(
self
,
col
):
# return f" where count({col}) > 0 "
...
...
@@ -50,9 +50,9 @@ class TDTestCase:
def
__group_condition
(
self
,
col
,
having
=
""
):
return
f
" group by
{
col
}
having
{
having
}
"
if
having
else
f
" group by
{
col
}
"
def
__length_current_check
(
self
,
tbname
):
length_condition
=
self
.
_
_length_condition
()
for
condition
in
length_condition
:
def
__
char_
length_current_check
(
self
,
tbname
):
char_length_condition
=
self
.
__char
_length_condition
()
for
condition
in
char_
length_condition
:
where_condition
=
self
.
__where_condition
(
condition
)
group_having
=
self
.
__group_condition
(
condition
,
having
=
f
"
{
condition
}
is not null "
)
group_no_having
=
self
.
__group_condition
(
condition
)
...
...
@@ -61,39 +61,39 @@ class TDTestCase:
for
group_condition
in
groups
:
tdSql
.
query
(
f
"select
{
condition
}
from
{
tbname
}
{
where_condition
}
{
group_condition
}
"
)
datas
=
[
tdSql
.
getData
(
i
,
0
)
for
i
in
range
(
tdSql
.
queryRows
)]
length_data
=
[
len
(
str
(
data
))
if
data
else
None
for
data
in
datas
]
tdSql
.
query
(
f
"select length(
{
condition
}
) from
{
tbname
}
{
where_condition
}
{
group_condition
}
"
)
for
i
in
range
(
len
(
length_data
)):
tdSql
.
checkData
(
i
,
0
,
length_data
[
i
]
)
if
length_data
[
i
]
else
tdSql
.
checkData
(
i
,
0
,
None
)
char_
length_data
=
[
len
(
str
(
data
))
if
data
else
None
for
data
in
datas
]
tdSql
.
query
(
f
"select
char_
length(
{
condition
}
) from
{
tbname
}
{
where_condition
}
{
group_condition
}
"
)
for
i
in
range
(
len
(
char_
length_data
)):
tdSql
.
checkData
(
i
,
0
,
char_length_data
[
i
]
)
if
char_
length_data
[
i
]
else
tdSql
.
checkData
(
i
,
0
,
None
)
def
__length_err_check
(
self
,
tbname
):
def
__
char_
length_err_check
(
self
,
tbname
):
sqls
=
[]
for
un_char_col
in
UN_CHAR_COL
:
sqls
.
extend
(
(
f
"select length(
{
un_char_col
}
) from
{
tbname
}
"
,
f
"select length(ceil(
{
un_char_col
}
)) from
{
tbname
}
"
,
f
"select
{
un_char_col
}
from
{
tbname
}
group by length(
{
un_char_col
}
) "
,
f
"select
char_
length(
{
un_char_col
}
) from
{
tbname
}
"
,
f
"select
char_
length(ceil(
{
un_char_col
}
)) from
{
tbname
}
"
,
f
"select
{
un_char_col
}
from
{
tbname
}
group by
char_
length(
{
un_char_col
}
) "
,
)
)
sqls
.
extend
(
f
"select length(
{
un_char_col
}
+
{
un_char_col_2
}
) from
{
tbname
}
"
for
un_char_col_2
in
UN_CHAR_COL
)
sqls
.
extend
(
f
"select length(
{
un_char_col
}
+
{
ts_col
}
) from
{
tbname
}
"
for
ts_col
in
TS_TYPE_COL
)
sqls
.
extend
(
f
"select
char_
length(
{
un_char_col
}
+
{
un_char_col_2
}
) from
{
tbname
}
"
for
un_char_col_2
in
UN_CHAR_COL
)
sqls
.
extend
(
f
"select
char_
length(
{
un_char_col
}
+
{
ts_col
}
) from
{
tbname
}
"
for
ts_col
in
TS_TYPE_COL
)
sqls
.
extend
(
f
"select
{
char_col
}
from
{
tbname
}
group by length(
{
char_col
}
) "
for
char_col
in
CHAR_COL
)
sqls
.
extend
(
f
"select length(
{
ts_col
}
) from
{
tbname
}
"
for
ts_col
in
TS_TYPE_COL
)
sqls
.
extend
(
f
"select length(
{
char_col
}
+
{
ts_col
}
) from
{
tbname
}
"
for
char_col
in
UN_CHAR_COL
for
ts_col
in
TS_TYPE_COL
)
sqls
.
extend
(
f
"select length(
{
char_col
}
+
{
char_col_2
}
) from
{
tbname
}
"
for
char_col
in
CHAR_COL
for
char_col_2
in
CHAR_COL
)
sqls
.
extend
(
f
"select
{
char_col
}
from
{
tbname
}
group by
char_
length(
{
char_col
}
) "
for
char_col
in
CHAR_COL
)
sqls
.
extend
(
f
"select
char_
length(
{
ts_col
}
) from
{
tbname
}
"
for
ts_col
in
TS_TYPE_COL
)
sqls
.
extend
(
f
"select
char_
length(
{
char_col
}
+
{
ts_col
}
) from
{
tbname
}
"
for
char_col
in
UN_CHAR_COL
for
ts_col
in
TS_TYPE_COL
)
sqls
.
extend
(
f
"select
char_
length(
{
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 length() from
{
tbname
}
"
,
f
"select length(*) from
{
tbname
}
"
,
f
"select length(ccccccc) from
{
tbname
}
"
,
f
"select length(111) from
{
tbname
}
"
,
f
"select length(c8, 11) from
{
tbname
}
"
,
f
"select
char_
length() from
{
tbname
}
"
,
f
"select
char_
length(*) from
{
tbname
}
"
,
f
"select
char_
length(ccccccc) from
{
tbname
}
"
,
f
"select
char_
length(111) from
{
tbname
}
"
,
f
"select
char_
length(c8, 11) from
{
tbname
}
"
,
)
)
...
...
@@ -103,7 +103,7 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"==========current sql condition check , must return query ok=========="
)
tbname
=
[
"ct1"
,
"ct2"
,
"ct4"
,
"t1"
,
"stb1"
]
for
tb
in
tbname
:
self
.
__length_current_check
(
tb
)
self
.
__
char_
length_current_check
(
tb
)
tdLog
.
printNoPrefix
(
f
"==========current sql condition check in
{
tb
}
over=========="
)
def
__test_error
(
self
):
...
...
@@ -111,7 +111,7 @@ class TDTestCase:
tbname
=
[
"ct1"
,
"ct2"
,
"ct4"
,
"t1"
,
"stb1"
]
for
tb
in
tbname
:
for
errsql
in
self
.
__length_err_check
(
tb
):
for
errsql
in
self
.
__
char_
length_err_check
(
tb
):
tdSql
.
error
(
sql
=
errsql
)
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录