Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3ddcfe3b
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看板
提交
3ddcfe3b
编写于
6月 22, 2022
作者:
C
cpwu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix case
上级
86fd683c
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
80 addition
and
21 deletion
+80
-21
tests/pytest/util/constant.py
tests/pytest/util/constant.py
+21
-1
tests/system-test/1-insert/time_range_wise.py
tests/system-test/1-insert/time_range_wise.py
+59
-20
未找到文件。
tests/pytest/util/constant.py
浏览文件 @
3ddcfe3b
...
...
@@ -67,3 +67,23 @@ MNODE_SHM_SIZE_DEFAULT = 6292480
VNODE_SHM_SIZE_MAX
=
2147483647
VNODE_SHM_SIZE_MIN
=
6292480
VNODE_SHM_SIZE_DEFAULT
=
31458304
# time_init
TIME_MS
=
1
TIME_US
=
TIME_MS
/
1000
TIME_NS
=
TIME_US
/
1000
TIME_S
=
1000
*
TIME_MS
TIME_M
=
60
*
TIME_S
TIME_H
=
60
*
TIME_M
TIME_D
=
24
*
TIME_H
TIME_W
=
7
*
TIME_D
TIME_N
=
30
*
TIME_D
TIME_Y
=
365
*
TIME_D
# streams and related agg-function
SMA_INDEX_FUNCTIONS
=
[
"MIN"
,
"MAX"
]
ROLLUP_FUNCTIONS
=
[
"AVG"
,
"SUM"
,
"MIN"
,
"MAX"
,
"LAST"
,
"FIRST"
]
SMA_WATMARK_MAXDELAY_INIT
=
[
'a'
,
"s"
,
"m"
]
\ No newline at end of file
tests/system-test/1-insert/time_range_wise.py
浏览文件 @
3ddcfe3b
...
...
@@ -7,7 +7,8 @@ from util.sql import *
from
util.cases
import
*
from
util.dnodes
import
*
from
util.constant
import
*
from
...pytest.util.sql
import
*
# from ...pytest.util.sql import *
# from ...pytest.util.constant import *
PRIMARY_COL
=
"ts"
...
...
@@ -31,6 +32,11 @@ CHAR_COL = [BINARY_COL, NCHAR_COL, ]
BOOLEAN_COL
=
[
BOOL_COL
,
]
TS_TYPE_COL
=
[
TS_COL
,
]
INT_TAG
=
"t_int"
ALL_COL
=
[
PRIMARY_COL
,
INT_COL
,
BINT_COL
,
SINT_COL
,
TINT_COL
,
FLOAT_COL
,
DOUBLE_COL
,
BINARY_COL
,
NCHAR_COL
,
BOOL_COL
,
TS_COL
]
TAG_COL
=
[
INT_TAG
]
# insert data args:
TIME_STEP
=
10000
NOW
=
int
(
datetime
.
datetime
.
timestamp
(
datetime
.
datetime
.
now
())
*
1000
)
...
...
@@ -183,49 +189,80 @@ class TDTestCase:
return
sql
def
__check_sma_func
(
self
,
func
:
tuple
):
sma_func_support
=
[
"min"
,
"max"
,
"avg"
]
if
not
isinstance
(
func
,
str
)
or
not
isinstance
(
func
,
tuple
)
or
not
isinstance
(
func
,
list
):
if
not
isinstance
(
func
,
str
)
and
not
isinstance
(
func
,
tuple
)
and
not
isinstance
(
func
,
list
):
return
False
if
isinstance
(
func
,
str
)
:
if
func
.
split
(
"("
)[
0
]
not
in
sma_func_support
:
if
"("
not
in
func
or
")"
not
in
func
:
return
False
if
func
.
split
(
"("
)[
0
].
upper
()
not
in
SMA_INDEX_FUNCTIONS
:
return
False
if
func
.
split
(
"("
)[
1
].
split
(
")"
)[
0
]
not
in
ALL_COL
and
func
.
split
(
"("
)[
1
].
split
(
")"
)[
0
]
not
in
TAG_COL
:
return
False
if
isinstance
(
func
,
tuple
)
or
isinstance
(
func
,
list
):
for
arg
in
func
:
if
not
isinstance
(
arg
,
str
):
return
False
if
"("
not
in
arg
or
")"
not
in
arg
:
return
False
if
arg
.
split
(
"("
)[
0
].
upper
()
not
in
SMA_INDEX_FUNCTIONS
:
return
False
if
arg
.
split
(
"("
)[
1
].
split
(
")"
)[
0
]
not
in
ALL_COL
and
arg
.
split
(
"("
)[
1
].
split
(
")"
)[
0
]
not
in
TAG_COL
:
return
False
return
True
def
__check_sma_watermark_max_dealy
(
self
,
arg
):
if
not
isinstance
(
arg
,
str
):
return
False
if
arg
[
-
1
]
not
in
SMA_WATMARK_MAXDELAY_INIT
:
return
False
def
sma_create_check
(
self
,
sma
:
SMAschema
):
def
__sma_create_check
(
self
,
sma
:
SMAschema
):
if
self
.
updatecfgDict
[
"querySmaOptimize"
]
==
0
:
tdSql
.
error
(
self
.
__create_sma_index
(
sma
))
return
False
tdSql
.
query
(
"show stables"
)
stb_in_list
=
False
for
row
in
tdSql
.
queryResult
:
if
sma
.
tbname
==
row
[
0
]:
stb_in_list
=
True
if
not
stb_in_list
:
tdSql
.
error
(
self
.
__create_sma_index
(
sma
))
return
False
if
not
sma
.
creation
or
not
isinstance
(
sma
.
creation
,
str
)
or
sma
.
creation
.
upper
()
!=
"CREATE"
:
tdSql
.
error
(
self
.
__create_sma_index
(
sma
))
return
False
if
not
sma
.
index_flag
or
not
isinstance
(
sma
.
index_flag
,
str
)
or
sma
.
index_flag
.
upper
()
!=
"SMA INDEX"
:
tdSql
.
error
(
self
.
__create_sma_index
(
sma
))
return
False
if
not
sma
.
index_name
or
not
isinstance
(
sma
.
index_name
,
str
):
tdSql
.
error
(
self
.
__create_sma_index
(
sma
))
return
False
if
not
sma
.
operator
or
not
isinstance
(
sma
.
operator
,
str
)
or
sma
.
operator
.
upper
()
!=
"ON"
:
tdSql
.
error
(
self
.
__create_sma_index
(
sma
))
return
False
if
not
sma
.
tbname
:
tdSql
.
error
(
self
.
__create_sma_index
(
sma
))
if
not
sma
.
func
:
tdSql
.
error
(
self
.
__create_sma_index
(
sma
))
return
False
if
not
sma
.
func
or
not
self
.
__check_sma_func
(
sma
.
func
)
:
return
False
if
not
sma
.
interval
:
tdSql
.
error
(
self
.
__create_sma_index
(
sma
))
if
not
sma
.
sliding
:
tdSql
.
error
(
self
.
__create_sma_index
(
sma
))
return
False
if
not
sma
.
sliding
:
return
False
if
not
sma
.
watermark
:
return
False
if
not
sma
.
max_delay
:
return
False
if
sma
.
other
:
tdSql
.
error
(
self
.
__create_sma_index
(
sma
))
return
False
return
True
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
))
@
property
def
__create_sma_sql
(
self
):
err_sqls
=
[]
cur_sqls
=
[]
# err_set
# case 1: required fields check
#
#
case 1: required fields check
err_sqls
.
append
(
SMAschema
(
creation
=
""
,
tbname
=
STBNAME
,
func
=
(
f
"min(
{
INT_COL
}
)"
,
f
"max(
{
INT_COL
}
)"
)
)
)
err_sqls
.
append
(
SMAschema
(
index_name
=
""
,
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
}
)"
)
)
)
...
...
@@ -234,6 +271,8 @@ class TDTestCase:
err_sqls
.
append
(
SMAschema
(
func
=
""
,
tbname
=
STBNAME
)
)
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
(
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
}
)"
)
)
)
return
err_sqls
,
cur_sqls
...
...
@@ -255,7 +294,7 @@ class TDTestCase:
{
BINARY_COL
}
binary(16),
{
NCHAR_COL
}
nchar(32),
{
TS_COL
}
timestamp,
{
TINT_UN_COL
}
tinyint unsigned,
{
SINT_UN_COL
}
smallint unsigned,
{
INT_UN_COL
}
int unsigned,
{
BINT_UN_COL
}
bigint unsigned
) tags (
tag1
int)
) tags (
{
INT_TAG
}
int)
'''
create_ntb_sql
=
f
'''create table
{
NTBNAME
}
(
ts timestamp,
{
INT_COL
}
int,
{
BINT_COL
}
bigint,
{
SINT_COL
}
smallint,
{
TINT_COL
}
tinyint,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录