Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d8440475
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看板
提交
d8440475
编写于
6月 24, 2022
作者:
C
cpwu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix case
上级
ee821197
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
53 addition
and
12 deletion
+53
-12
tests/pytest/util/constant.py
tests/pytest/util/constant.py
+4
-0
tests/system-test/1-insert/time_range_wise.py
tests/system-test/1-insert/time_range_wise.py
+49
-12
未找到文件。
tests/pytest/util/constant.py
浏览文件 @
d8440475
...
...
@@ -27,6 +27,8 @@ TAOS_BIN_TYPE = [
TAOS_TIME_INIT
=
[
"b"
,
"u"
,
"a"
,
"s"
,
"m"
,
"h"
,
"d"
,
"w"
,
"n"
,
"y"
]
TAOS_PRECISION
=
[
"ms"
,
"us"
,
"ns"
]
PRECISION_DEFAULT
=
"ms"
PRECISION
=
PRECISION_DEFAULT
# basic data type boundary
TINYINT_MAX
=
127
...
...
@@ -110,6 +112,8 @@ TIME_N = 30 * TIME_D
TIME_Y
=
365
*
TIME_D
# session parameters
INTERVAL_MIN
=
1
*
TIME_MS
if
PRECISION
==
PRECISION_DEFAULT
else
1
*
TIME_US
# streams and related agg-function
...
...
tests/system-test/1-insert/time_range_wise.py
浏览文件 @
d8440475
...
...
@@ -142,8 +142,8 @@ class SMAschema:
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
:
updatecfgDict
=
{
"querySmaOptimize"
:
1
}
...
...
@@ -170,7 +170,11 @@ class TDTestCase:
if
sma
.
func
:
sql
+=
f
" function(
{
', '
.
join
(
sma
.
func
)
}
)"
if
sma
.
interval
:
sql
+=
f
" interval(
{
', '
.
join
(
sma
.
interval
)
}
)"
interval
,
offset
=
self
.
__get_interval_offset
(
sma
.
interval
)
if
offset
:
sql
+=
f
" interval(
{
interval
}
,
{
offset
}
)"
else
:
sql
+=
f
" interval(
{
interval
}
)"
if
sma
.
sliding
:
sql
+=
f
" sliding(
{
sma
.
sliding
}
)"
if
sma
.
watermark
:
...
...
@@ -213,6 +217,8 @@ class TDTestCase:
return
True
def
__check_sma_watermark
(
self
,
arg
):
if
not
arg
:
return
False
if
not
isinstance
(
arg
,
str
):
return
False
if
arg
[
-
1
]
not
in
SMA_WATMARK_MAXDELAY_INIT
:
...
...
@@ -229,13 +235,14 @@ class TDTestCase:
return
True
def
__check_sma_max_delay
(
self
,
arg
):
self
.
__check_sma_watermark
(
arg
)
if
not
self
.
__check_sma_watermark
(
arg
):
return
False
if
tdSql
.
get_times
(
arg
)
<
MAX_DELAY_MIN
:
return
False
return
True
def
__check_sliding
(
self
,
arg
):
def
__check_s
ma_s
liding
(
self
,
arg
):
if
not
isinstance
(
arg
,
str
):
return
False
if
arg
[
-
1
]
not
in
TAOS_TIME_INIT
:
...
...
@@ -245,10 +252,40 @@ class TDTestCase:
if
not
arg
[:
-
1
].
isdecimal
():
return
False
return
True
def
__check_interval
(
self
,
arg
):
if
not
isinstance
(
arg
,
tuple
):
def
__get_interval_offset
(
self
,
args
):
if
isinstance
(
args
,
str
):
interval
,
offset
=
args
,
None
elif
isinstance
(
args
,
tuple
)
or
isinstance
(
args
,
list
):
if
len
(
args
)
==
1
:
interval
,
offset
=
args
[
0
],
None
elif
len
(
args
)
==
2
:
interval
,
offset
=
args
else
:
interval
,
offset
=
False
,
False
else
:
interval
,
offset
=
False
,
False
return
interval
,
offset
def
__check_sma_interval
(
self
,
args
):
if
not
isinstance
(
args
,
tuple
)
and
not
isinstance
(
args
,
str
):
return
False
interval
,
offset
=
self
.
__get_interval_offset
(
args
)
if
not
interval
:
return
False
if
not
self
.
__check_sma_sliding
(
interval
):
return
False
if
tdSql
.
get_times
(
interval
)
<
INTERVAL_MIN
:
return
False
if
offset
:
if
not
self
.
__check_sma_sliding
(
offset
):
return
False
if
tdSql
.
get_times
(
interval
)
<=
tdSql
.
get_times
(
offset
)
:
return
False
return
True
def
__sma_create_check
(
self
,
sma
:
SMAschema
):
if
self
.
updatecfgDict
[
"querySmaOptimize"
]
==
0
:
...
...
@@ -272,9 +309,10 @@ class TDTestCase:
return
False
if
not
sma
.
func
or
not
self
.
__check_sma_func
(
sma
.
func
):
return
False
if
not
sma
.
interval
:
if
not
sma
.
sliding
or
not
self
.
__check_sma_sliding
(
sma
.
sliding
)
:
return
False
if
not
sma
.
sliding
:
interval
,
_
=
self
.
__get_interval_offset
(
sma
.
interval
)
if
not
sma
.
interval
or
not
self
.
__check_sma_interval
(
sma
.
interval
)
or
tdSql
.
get_times
(
interval
)
<
tdSql
.
get_times
(
sma
.
sliding
):
return
False
if
not
sma
.
watermark
or
not
self
.
__check_sma_watermark
(
sma
.
watermark
):
return
False
...
...
@@ -300,10 +338,10 @@ class TDTestCase:
# 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(func="",tbname=STBNAME ) )
# err_sqls.append( SMAschema(interval=""
,tbname=STBNAME, func=(f"min({INT_COL})",f"max({INT_COL})") ) )
err_sqls
.
append
(
SMAschema
(
interval
=
(
"6m"
)
,
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
}
)"
)
)
)
#
err_sqls.append( SMAschema(watermark="",tbname=STBNAME, func=(f"min({INT_COL})",f"max({INT_COL})") ) )
return
err_sqls
,
cur_sqls
...
...
@@ -311,7 +349,6 @@ class TDTestCase:
def
test_create_sma
(
self
):
err_sqls
,
cur_sqls
=
self
.
__create_sma_sql
for
err_sql
in
err_sqls
:
print
(
type
(
err_sql
.
watermark
))
self
.
sma_create_check
(
err_sql
)
def
all_test
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录