Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7e6ddc7a
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看板
提交
7e6ddc7a
编写于
6月 24, 2022
作者:
C
cpwu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix case
上级
74b52270
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
94 addition
and
9 deletion
+94
-9
tests/pytest/util/sql.py
tests/pytest/util/sql.py
+1
-2
tests/system-test/1-insert/time_range_wise.py
tests/system-test/1-insert/time_range_wise.py
+93
-7
未找到文件。
tests/pytest/util/sql.py
浏览文件 @
7e6ddc7a
...
@@ -118,8 +118,7 @@ class TDSql:
...
@@ -118,8 +118,7 @@ class TDSql:
col_name_list
=
[]
col_name_list
=
[]
col_type_list
=
[]
col_type_list
=
[]
self
.
cursor
.
execute
(
sql
)
self
.
cursor
.
execute
(
sql
)
self
.
queryCols
=
self
.
cursor
.
description
for
query_col
in
self
.
cursor
.
description
:
for
query_col
in
self
.
queryCols
:
col_name_list
.
append
(
query_col
[
0
])
col_name_list
.
append
(
query_col
[
0
])
col_type_list
.
append
(
query_col
[
1
])
col_type_list
.
append
(
query_col
[
1
])
except
Exception
as
e
:
except
Exception
as
e
:
...
...
tests/system-test/1-insert/time_range_wise.py
浏览文件 @
7e6ddc7a
...
@@ -96,6 +96,10 @@ class SMAschema:
...
@@ -96,6 +96,10 @@ class SMAschema:
drop
:
str
=
"DROP"
drop
:
str
=
"DROP"
drop_flag
:
str
=
"INDEX"
drop_flag
:
str
=
"INDEX"
querySmaOptimize
:
int
=
1
querySmaOptimize
:
int
=
1
show
:
str
=
"SHOW"
show_msg
:
str
=
"INDEXES"
show_oper
:
str
=
"FROM"
dbname
:
str
=
None
def
__post_init__
(
self
):
def
__post_init__
(
self
):
if
isinstance
(
self
.
other
,
dict
):
if
isinstance
(
self
.
other
,
dict
):
...
@@ -141,9 +145,21 @@ class SMAschema:
...
@@ -141,9 +145,21 @@ class SMAschema:
self
.
drop_flag
=
v
self
.
drop_flag
=
v
del
self
.
other
[
k
]
del
self
.
other
[
k
]
if
k
.
lower
()
==
"show_msg"
and
isinstance
(
v
,
str
)
and
not
self
.
show_msg
:
self
.
show_msg
=
v
del
self
.
other
[
k
]
if
k
.
lower
()
==
"dbname"
and
isinstance
(
v
,
str
)
and
not
self
.
dbname
:
self
.
dbname
=
v
del
self
.
other
[
k
]
if
k
.
lower
()
==
"show_oper"
and
isinstance
(
v
,
str
)
and
not
self
.
show_oper
:
self
.
show_oper
=
v
del
self
.
other
[
k
]
# from ...pytest.util.sql import *
# from ...pytest.util.constant import *
from
...pytest.util.sql
import
*
from
...pytest.util.constant
import
*
class
TDTestCase
:
class
TDTestCase
:
updatecfgDict
=
{
"querySmaOptimize"
:
1
}
updatecfgDict
=
{
"querySmaOptimize"
:
1
}
...
@@ -152,6 +168,7 @@ class TDTestCase:
...
@@ -152,6 +168,7 @@ class TDTestCase:
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdSql
.
init
(
conn
.
cursor
(),
False
)
tdSql
.
init
(
conn
.
cursor
(),
False
)
self
.
precision
=
"ms"
self
.
precision
=
"ms"
self
.
sma_count
=
0
"""
"""
create sma index :
create sma index :
...
@@ -194,6 +211,17 @@ class TDTestCase:
...
@@ -194,6 +211,17 @@ class TDTestCase:
return
sql
return
sql
def
__get_sma_func_col
(
self
,
func
):
cols
=
[]
if
isinstance
(
func
,
str
):
cols
.
append
(
func
.
split
(
"("
)[
-
1
].
split
(
")"
)[
0
]
)
elif
isinstance
(
func
,
tuple
)
or
isinstance
(
func
,
list
):
for
func_col
in
func
:
cols
.
append
(
func_col
.
split
(
"("
)[
-
1
].
split
(
")"
)[
0
])
else
:
cols
=
[]
return
cols
def
__check_sma_func
(
self
,
func
:
tuple
):
def
__check_sma_func
(
self
,
func
:
tuple
):
if
not
isinstance
(
func
,
str
)
and
not
isinstance
(
func
,
tuple
)
and
not
isinstance
(
func
,
list
):
if
not
isinstance
(
func
,
str
)
and
not
isinstance
(
func
,
tuple
)
and
not
isinstance
(
func
,
list
):
return
False
return
False
...
@@ -291,6 +319,8 @@ class TDTestCase:
...
@@ -291,6 +319,8 @@ class TDTestCase:
if
self
.
updatecfgDict
[
"querySmaOptimize"
]
==
0
:
if
self
.
updatecfgDict
[
"querySmaOptimize"
]
==
0
:
return
False
return
False
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
if
not
sma
.
tbname
:
return
False
stb_in_list
=
False
stb_in_list
=
False
for
row
in
tdSql
.
queryResult
:
for
row
in
tdSql
.
queryResult
:
if
sma
.
tbname
==
row
[
0
]:
if
sma
.
tbname
==
row
[
0
]:
...
@@ -305,10 +335,18 @@ class TDTestCase:
...
@@ -305,10 +335,18 @@ class TDTestCase:
return
False
return
False
if
not
sma
.
operator
or
not
isinstance
(
sma
.
operator
,
str
)
or
sma
.
operator
.
upper
()
!=
"ON"
:
if
not
sma
.
operator
or
not
isinstance
(
sma
.
operator
,
str
)
or
sma
.
operator
.
upper
()
!=
"ON"
:
return
False
return
False
if
not
sma
.
tbname
:
return
False
if
not
sma
.
func
or
not
self
.
__check_sma_func
(
sma
.
func
):
if
not
sma
.
func
or
not
self
.
__check_sma_func
(
sma
.
func
):
return
False
return
False
tdSql
.
query
(
f
"desc
{
sma
.
tbname
}
"
)
_col_list
=
[]
for
col_row
in
tdSql
.
queryResult
:
_col_list
.
append
(
col_row
[
0
])
_sma_func_cols
=
self
.
__get_sma_func_col
(
sma
.
func
)
for
_sma_func_col
in
_sma_func_cols
:
if
_sma_func_col
not
in
_col_list
:
return
False
if
not
sma
.
sliding
or
not
self
.
__check_sma_sliding
(
sma
.
sliding
):
if
not
sma
.
sliding
or
not
self
.
__check_sma_sliding
(
sma
.
sliding
):
return
False
return
False
interval
,
_
=
self
.
__get_interval_offset
(
sma
.
interval
)
interval
,
_
=
self
.
__get_interval_offset
(
sma
.
interval
)
...
@@ -324,7 +362,55 @@ class TDTestCase:
...
@@ -324,7 +362,55 @@ class TDTestCase:
return
True
return
True
def
sma_create_check
(
self
,
sma
:
SMAschema
):
def
sma_create_check
(
self
,
sma
:
SMAschema
):
tdSql
.
query
(
self
.
__create_sma_index
(
sma
))
if
self
.
__sma_create_check
(
sma
)
else
tdSql
.
error
(
self
.
__create_sma_index
(
sma
))
if
self
.
__sma_create_check
(
sma
):
tdSql
.
query
(
self
.
__create_sma_index
(
sma
))
self
.
sma_count
+=
1
else
:
tdSql
.
error
(
self
.
__create_sma_index
(
sma
))
def
__drop_sma_index
(
self
,
sma
:
SMAschema
):
sql
=
f
"
{
sma
.
drop
}
{
sma
.
drop_flag
}
{
sma
.
index_name
}
"
return
sql
def
__sma_drop_check
(
self
,
sma
:
SMAschema
):
if
not
sma
.
drop
:
return
False
if
not
sma
.
drop_flag
:
return
False
if
not
sma
.
index_name
:
return
False
return
True
def
sma_drop_check
(
self
,
sma
:
SMAschema
):
if
self
.
__sma_drop_check
(
sma
):
tdSql
.
query
(
self
.
__drop_sma_index
(
sma
))
self
.
sma_count
-=
1
else
:
tdSql
.
error
(
self
.
__drop_sma_index
(
sma
))
def
__show_sma_index
(
self
,
sma
:
SMAschema
):
sql
=
f
"
{
sma
.
show
}
{
sma
.
show_msg
}
{
sma
.
show_oper
}
{
sma
.
tbname
}
"
return
sql
def
__sma_show_check
(
self
,
sma
:
SMAschema
):
if
not
sma
.
show
:
return
False
if
not
sma
.
show_msg
:
return
False
if
not
sma
.
show_oper
:
return
False
if
not
sma
.
tbname
:
return
False
return
True
def
sma_show_check
(
self
,
sma
:
SMAschema
):
if
self
.
__sma_show_check
(
sma
):
tdSql
.
query
(
self
.
__show_sma_index
(
sma
))
tdSql
.
checkRows
(
self
.
sma_count
)
else
:
tdSql
.
error
(
self
.
__show_sma_index
(
sma
))
@
property
@
property
def
__create_sma_sql
(
self
):
def
__create_sma_sql
(
self
):
...
@@ -337,8 +423,8 @@ class TDTestCase:
...
@@ -337,8 +423,8 @@ class TDTestCase:
# err_sqls.append( SMAschema(index_flag="",tbname=STBNAME, func=(f"min({INT_COL})",f"max({INT_COL})") ) )
# err_sqls.append( SMAschema(index_flag="",tbname=STBNAME, func=(f"min({INT_COL})",f"max({INT_COL})") ) )
# err_sqls.append( SMAschema(operator="",tbname=STBNAME, func=(f"min({INT_COL})",f"max({INT_COL})") ) )
# err_sqls.append( SMAschema(operator="",tbname=STBNAME, func=(f"min({INT_COL})",f"max({INT_COL})") ) )
# err_sqls.append( SMAschema(tbname="", func=(f"min({INT_COL})",f"max({INT_COL})") ) )
# err_sqls.append( SMAschema(tbname="", func=(f"min({INT_COL})",f"max({INT_COL})") ) )
# err_sqls.append( SMAschema(func=""
,tbname=STBNAME ) )
err_sqls
.
append
(
SMAschema
(
func
=
(
""
,)
,
tbname
=
STBNAME
)
)
err_sqls
.
append
(
SMAschema
(
interval
=
(
"6m
"
),
tbname
=
STBNAME
,
func
=
(
f
"min(
{
INT_COL
}
)"
,
f
"max(
{
INT_COL
}
)"
)
)
)
# err_sqls.append( SMAschema(interval=("
"),tbname=STBNAME, func=(f"min({INT_COL})",f"max({INT_COL})") ) )
# err_sqls.append( SMAschema(sliding="",tbname=STBNAME, func=(f"min({INT_COL})",f"max({INT_COL})") ) )
# err_sqls.append( SMAschema(sliding="",tbname=STBNAME, func=(f"min({INT_COL})",f"max({INT_COL})") ) )
# err_sqls.append( SMAschema(max_delay="",tbname=STBNAME, func=(f"min({INT_COL})",f"max({INT_COL})") ) )
# err_sqls.append( SMAschema(max_delay="",tbname=STBNAME, func=(f"min({INT_COL})",f"max({INT_COL})") ) )
# err_sqls.append( SMAschema(watermark="",tbname=STBNAME, func=(f"min({INT_COL})",f"max({INT_COL})") ) )
# err_sqls.append( SMAschema(watermark="",tbname=STBNAME, func=(f"min({INT_COL})",f"max({INT_COL})") ) )
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录