Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
82baf3aa
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
“c866b9f13cb2f1dbbe190f609feb7a90f2006a40”上不存在“docs/examples/c/tmq.c”
提交
82baf3aa
编写于
11月 15, 2022
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix test cases
上级
2b53f7be
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
3543 addition
and
3542 deletion
+3543
-3542
tests/system-test/2-query/csum.py
tests/system-test/2-query/csum.py
+16
-16
tests/system-test/2-query/function_diff.py
tests/system-test/2-query/function_diff.py
+13
-13
tests/system-test/2-query/irate.py
tests/system-test/2-query/irate.py
+1
-1
tests/system-test/2-query/mavg.py
tests/system-test/2-query/mavg.py
+11
-10
tests/system-test/2-query/max_partition.py
tests/system-test/2-query/max_partition.py
+6
-6
tests/system-test/2-query/nestedQuery.py
tests/system-test/2-query/nestedQuery.py
+1939
-1939
tests/system-test/2-query/stablity.py
tests/system-test/2-query/stablity.py
+1528
-1528
tests/system-test/2-query/stablity_1.py
tests/system-test/2-query/stablity_1.py
+29
-29
未找到文件。
tests/system-test/2-query/csum.py
浏览文件 @
82baf3aa
...
@@ -24,7 +24,7 @@ from util.cases import *
...
@@ -24,7 +24,7 @@ from util.cases import *
from
util.sql
import
*
from
util.sql
import
*
from
util.dnodes
import
*
from
util.dnodes
import
*
msec_per_min
=
60
*
1000
class
TDTestCase
:
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
,
replicaVar
=
1
):
def
init
(
self
,
conn
,
logSql
,
replicaVar
=
1
):
self
.
replicaVar
=
int
(
replicaVar
)
self
.
replicaVar
=
int
(
replicaVar
)
...
@@ -54,7 +54,7 @@ class TDTestCase:
...
@@ -54,7 +54,7 @@ class TDTestCase:
if
tdSql
.
queryRows
==
0
:
if
tdSql
.
queryRows
==
0
:
tdSql
.
query
(
self
.
csum_query_form
(
tdSql
.
query
(
self
.
csum_query_form
(
col
=
col
,
alias
=
alias
,
table_expr
=
table_expr
,
condition
=
condition
col
=
col
,
alias
=
alias
,
table_expr
=
table_expr
.
replace
(
"csum"
,
"ts, csum"
)
,
condition
=
condition
))
))
print
(
f
"case in
{
line
}
: "
,
end
=
''
)
print
(
f
"case in
{
line
}
: "
,
end
=
''
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
...
@@ -132,7 +132,7 @@ class TDTestCase:
...
@@ -132,7 +132,7 @@ class TDTestCase:
pre_result
=
np
.
array
(
pre_result
,
dtype
=
'int64'
)
pre_result
=
np
.
array
(
pre_result
,
dtype
=
'int64'
)
pre_csum
=
np
.
cumsum
(
pre_result
)[
offset_val
:]
pre_csum
=
np
.
cumsum
(
pre_result
)[
offset_val
:]
tdSql
.
query
(
self
.
csum_query_form
(
tdSql
.
query
(
self
.
csum_query_form
(
col
=
col
,
alias
=
alias
,
table_expr
=
table_expr
,
condition
=
condition
col
=
col
,
alias
=
alias
,
table_expr
=
table_expr
.
replace
(
"csum"
,
"ts,csum"
)
,
condition
=
condition
))
))
for
i
in
range
(
tdSql
.
queryRows
):
for
i
in
range
(
tdSql
.
queryRows
):
...
@@ -163,7 +163,7 @@ class TDTestCase:
...
@@ -163,7 +163,7 @@ class TDTestCase:
self
.
checkcsum
(
**
case6
)
self
.
checkcsum
(
**
case6
)
# case7~8: nested query
# case7~8: nested query
case7
=
{
"table_expr"
:
"(select c1 from db.stb1 order by ts, tbname )"
}
case7
=
{
"table_expr"
:
"(select
ts,
c1 from db.stb1 order by ts, tbname )"
}
self
.
checkcsum
(
**
case7
)
self
.
checkcsum
(
**
case7
)
case8
=
{
"table_expr"
:
"(select csum(c1) c1 from db.t1)"
}
case8
=
{
"table_expr"
:
"(select csum(c1) c1 from db.t1)"
}
self
.
checkcsum
(
**
case8
)
self
.
checkcsum
(
**
case8
)
...
@@ -315,19 +315,19 @@ class TDTestCase:
...
@@ -315,19 +315,19 @@ class TDTestCase:
for
j
in
range
(
data_row
):
for
j
in
range
(
data_row
):
tdSql
.
execute
(
tdSql
.
execute
(
f
"insert into t
{
i
}
values ("
f
"insert into t
{
i
}
values ("
f
"
{
basetime
+
(
j
+
1
)
*
10
}
,
{
random
.
randint
(
-
200
,
-
1
)
}
,
{
random
.
uniform
(
200
,
-
1
)
}
,
{
basetime
+
random
.
randint
(
-
200
,
-
1
)
}
, "
f
"
{
basetime
+
(
j
+
1
)
*
10
+
i
*
msec_per_min
}
,
{
random
.
randint
(
-
200
,
-
1
)
}
,
{
random
.
uniform
(
200
,
-
1
)
}
,
{
basetime
+
random
.
randint
(
-
200
,
-
1
)
}
, "
f
"'binary_
{
j
}
',
{
random
.
uniform
(
-
200
,
-
1
)
}
,
{
random
.
choice
([
0
,
1
])
}
,
{
random
.
randint
(
-
200
,
-
1
)
}
, "
f
"'binary_
{
j
}
',
{
random
.
uniform
(
-
200
,
-
1
)
}
,
{
random
.
choice
([
0
,
1
])
}
,
{
random
.
randint
(
-
200
,
-
1
)
}
, "
f
"
{
random
.
randint
(
-
200
,
-
1
)
}
,
{
random
.
randint
(
-
127
,
-
1
)
}
, 'nchar_
{
j
}
' )"
f
"
{
random
.
randint
(
-
200
,
-
1
)
}
,
{
random
.
randint
(
-
127
,
-
1
)
}
, 'nchar_
{
j
}
' )"
)
)
tdSql
.
execute
(
tdSql
.
execute
(
f
"insert into t
{
i
}
values ("
f
"insert into t
{
i
}
values ("
f
"
{
basetime
-
(
j
+
1
)
*
10
}
,
{
random
.
randint
(
1
,
200
)
}
,
{
random
.
uniform
(
1
,
200
)
}
,
{
basetime
-
random
.
randint
(
1
,
200
)
}
, "
f
"
{
basetime
-
(
j
+
1
)
*
10
+
i
*
msec_per_min
}
,
{
random
.
randint
(
1
,
200
)
}
,
{
random
.
uniform
(
1
,
200
)
}
,
{
basetime
-
random
.
randint
(
1
,
200
)
}
, "
f
"'binary_
{
j
}
_1',
{
random
.
uniform
(
1
,
200
)
}
,
{
random
.
choice
([
0
,
1
])
}
,
{
random
.
randint
(
1
,
200
)
}
, "
f
"'binary_
{
j
}
_1',
{
random
.
uniform
(
1
,
200
)
}
,
{
random
.
choice
([
0
,
1
])
}
,
{
random
.
randint
(
1
,
200
)
}
, "
f
"
{
random
.
randint
(
1
,
200
)
}
,
{
random
.
randint
(
1
,
127
)
}
, 'nchar_
{
j
}
_1' )"
f
"
{
random
.
randint
(
1
,
200
)
}
,
{
random
.
randint
(
1
,
127
)
}
, 'nchar_
{
j
}
_1' )"
)
)
tdSql
.
execute
(
tdSql
.
execute
(
f
"insert into tt
{
i
}
values (
{
basetime
-
(
j
+
1
)
*
10
}
,
{
random
.
randint
(
1
,
200
)
}
)"
f
"insert into tt
{
i
}
values (
{
basetime
-
(
j
+
1
)
*
10
+
i
*
msec_per_min
}
,
{
random
.
randint
(
1
,
200
)
}
)"
)
)
pass
pass
...
@@ -366,26 +366,26 @@ class TDTestCase:
...
@@ -366,26 +366,26 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"######## insert only NULL test:"
)
tdLog
.
printNoPrefix
(
"######## insert only NULL test:"
)
for
i
in
range
(
tbnum
):
for
i
in
range
(
tbnum
):
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
-
5
}
)"
)
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
-
5
+
i
*
msec_per_min
}
)"
)
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
+
5
}
)"
)
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
+
5
+
i
*
msec_per_min
}
)"
)
self
.
csum_current_query
()
self
.
csum_current_query
()
self
.
csum_error_query
()
self
.
csum_error_query
()
tdLog
.
printNoPrefix
(
"######## insert data in the range near the max(bigint/double):"
)
tdLog
.
printNoPrefix
(
"######## insert data in the range near the max(bigint/double):"
)
self
.
csum_test_table
(
tbnum
)
self
.
csum_test_table
(
tbnum
)
tdSql
.
execute
(
f
"insert into db.t1(ts, c1,c2,c5,c7) values "
tdSql
.
execute
(
f
"insert into db.t1(ts, c1,c2,c5,c7) values "
f
"(
{
nowtime
-
(
per_table_rows
+
1
)
*
10
}
,
{
2
**
31
-
1
}
,
{
3.4
*
10
**
38
}
,
{
1.7
*
10
**
308
}
,
{
2
**
63
-
1
}
)"
)
f
"(
{
nowtime
-
(
per_table_rows
+
1
)
*
10
+
i
*
msec_per_min
}
,
{
2
**
31
-
1
}
,
{
3.4
*
10
**
38
}
,
{
1.7
*
10
**
308
}
,
{
2
**
63
-
1
}
)"
)
tdSql
.
execute
(
f
"insert into db.t1(ts, c1,c2,c5,c7) values "
tdSql
.
execute
(
f
"insert into db.t1(ts, c1,c2,c5,c7) values "
f
"(
{
nowtime
-
(
per_table_rows
+
2
)
*
10
}
,
{
2
**
31
-
1
}
,
{
3.4
*
10
**
38
}
,
{
1.7
*
10
**
308
}
,
{
2
**
63
-
1
}
)"
)
f
"(
{
nowtime
-
(
per_table_rows
+
2
)
*
10
+
i
*
msec_per_min
}
,
{
2
**
31
-
1
}
,
{
3.4
*
10
**
38
}
,
{
1.7
*
10
**
308
}
,
{
2
**
63
-
1
}
)"
)
self
.
csum_current_query
()
self
.
csum_current_query
()
self
.
csum_error_query
()
self
.
csum_error_query
()
tdLog
.
printNoPrefix
(
"######## insert data in the range near the min(bigint/double):"
)
tdLog
.
printNoPrefix
(
"######## insert data in the range near the min(bigint/double):"
)
self
.
csum_test_table
(
tbnum
)
self
.
csum_test_table
(
tbnum
)
tdSql
.
execute
(
f
"insert into db.t1(ts, c1,c2,c5,c7) values "
tdSql
.
execute
(
f
"insert into db.t1(ts, c1,c2,c5,c7) values "
f
"(
{
nowtime
-
(
per_table_rows
+
1
)
*
10
}
,
{
1
-
2
**
31
}
,
{
-
3.4
*
10
**
38
}
,
{
-
1.7
*
10
**
308
}
,
{
1
-
2
**
63
}
)"
)
f
"(
{
nowtime
-
(
per_table_rows
+
1
)
*
10
+
i
*
msec_per_min
}
,
{
1
-
2
**
31
}
,
{
-
3.4
*
10
**
38
}
,
{
-
1.7
*
10
**
308
}
,
{
1
-
2
**
63
}
)"
)
tdSql
.
execute
(
f
"insert into db.t1(ts, c1,c2,c5,c7) values "
tdSql
.
execute
(
f
"insert into db.t1(ts, c1,c2,c5,c7) values "
f
"(
{
nowtime
-
(
per_table_rows
+
2
)
*
10
}
,
{
1
-
2
**
31
}
,
{
-
3.4
*
10
**
38
}
,
{
-
1.7
*
10
**
308
}
,
{
512
-
2
**
63
}
)"
)
f
"(
{
nowtime
-
(
per_table_rows
+
2
)
*
10
+
i
*
msec_per_min
}
,
{
1
-
2
**
31
}
,
{
-
3.4
*
10
**
38
}
,
{
-
1.7
*
10
**
308
}
,
{
512
-
2
**
63
}
)"
)
self
.
csum_current_query
()
self
.
csum_current_query
()
self
.
csum_error_query
()
self
.
csum_error_query
()
...
@@ -398,9 +398,9 @@ class TDTestCase:
...
@@ -398,9 +398,9 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"######## insert data mix with NULL test:"
)
tdLog
.
printNoPrefix
(
"######## insert data mix with NULL test:"
)
for
i
in
range
(
tbnum
):
for
i
in
range
(
tbnum
):
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
}
)"
)
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
+
i
*
msec_per_min
}
)"
)
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
-
(
per_table_rows
+
3
)
*
10
}
)"
)
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
-
(
per_table_rows
+
3
)
*
10
+
i
*
msec_per_min
}
)"
)
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
+
(
per_table_rows
+
3
)
*
10
}
)"
)
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
+
(
per_table_rows
+
3
)
*
10
+
i
*
msec_per_min
}
)"
)
self
.
csum_current_query
()
self
.
csum_current_query
()
self
.
csum_error_query
()
self
.
csum_error_query
()
...
...
tests/system-test/2-query/function_diff.py
浏览文件 @
82baf3aa
...
@@ -24,7 +24,7 @@ from util.cases import *
...
@@ -24,7 +24,7 @@ from util.cases import *
from
util.sql
import
*
from
util.sql
import
*
from
util.dnodes
import
*
from
util.dnodes
import
*
msec_per_min
=
60
*
1000
class
TDTestCase
:
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
,
replicaVar
=
1
):
def
init
(
self
,
conn
,
logSql
,
replicaVar
=
1
):
self
.
replicaVar
=
int
(
replicaVar
)
self
.
replicaVar
=
int
(
replicaVar
)
...
@@ -312,19 +312,19 @@ class TDTestCase:
...
@@ -312,19 +312,19 @@ class TDTestCase:
for
j
in
range
(
data_row
):
for
j
in
range
(
data_row
):
tdSql
.
execute
(
tdSql
.
execute
(
f
"insert into db.t
{
i
}
values ("
f
"insert into db.t
{
i
}
values ("
f
"
{
basetime
+
(
j
+
1
)
*
10
}
,
{
random
.
randint
(
-
200
,
-
1
)
}
,
{
random
.
uniform
(
200
,
-
1
)
}
,
{
basetime
+
random
.
randint
(
-
200
,
-
1
)
}
, "
f
"
{
basetime
+
(
j
+
1
)
*
10
+
i
*
msec_per_min
}
,
{
random
.
randint
(
-
200
,
-
1
)
}
,
{
random
.
uniform
(
200
,
-
1
)
}
,
{
basetime
+
random
.
randint
(
-
200
,
-
1
)
}
, "
f
"'binary_
{
j
}
',
{
random
.
uniform
(
-
200
,
-
1
)
}
,
{
random
.
choice
([
0
,
1
])
}
,
{
random
.
randint
(
-
200
,
-
1
)
}
, "
f
"'binary_
{
j
}
',
{
random
.
uniform
(
-
200
,
-
1
)
}
,
{
random
.
choice
([
0
,
1
])
}
,
{
random
.
randint
(
-
200
,
-
1
)
}
, "
f
"
{
random
.
randint
(
-
200
,
-
1
)
}
,
{
random
.
randint
(
-
127
,
-
1
)
}
, 'nchar_
{
j
}
' )"
f
"
{
random
.
randint
(
-
200
,
-
1
)
}
,
{
random
.
randint
(
-
127
,
-
1
)
}
, 'nchar_
{
j
}
' )"
)
)
tdSql
.
execute
(
tdSql
.
execute
(
f
"insert into db.t
{
i
}
values ("
f
"insert into db.t
{
i
}
values ("
f
"
{
basetime
-
(
j
+
1
)
*
10
}
,
{
random
.
randint
(
1
,
200
)
}
,
{
random
.
uniform
(
1
,
200
)
}
,
{
basetime
-
random
.
randint
(
1
,
200
)
}
, "
f
"
{
basetime
-
(
j
+
1
)
*
10
+
i
*
msec_per_min
}
,
{
random
.
randint
(
1
,
200
)
}
,
{
random
.
uniform
(
1
,
200
)
}
,
{
basetime
-
random
.
randint
(
1
,
200
)
}
, "
f
"'binary_
{
j
}
_1',
{
random
.
uniform
(
1
,
200
)
}
,
{
random
.
choice
([
0
,
1
])
}
,
{
random
.
randint
(
1
,
200
)
}
, "
f
"'binary_
{
j
}
_1',
{
random
.
uniform
(
1
,
200
)
}
,
{
random
.
choice
([
0
,
1
])
}
,
{
random
.
randint
(
1
,
200
)
}
, "
f
"
{
random
.
randint
(
1
,
200
)
}
,
{
random
.
randint
(
1
,
127
)
}
, 'nchar_
{
j
}
_1' )"
f
"
{
random
.
randint
(
1
,
200
)
}
,
{
random
.
randint
(
1
,
127
)
}
, 'nchar_
{
j
}
_1' )"
)
)
tdSql
.
execute
(
tdSql
.
execute
(
f
"insert into db.tt
{
i
}
values (
{
basetime
-
(
j
+
1
)
*
10
}
,
{
random
.
randint
(
1
,
200
)
}
)"
f
"insert into db.tt
{
i
}
values (
{
basetime
-
(
j
+
1
)
*
10
+
i
*
msec_per_min
}
,
{
random
.
randint
(
1
,
200
)
}
)"
)
)
pass
pass
...
@@ -394,26 +394,26 @@ class TDTestCase:
...
@@ -394,26 +394,26 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"######## insert only NULL test:"
)
tdLog
.
printNoPrefix
(
"######## insert only NULL test:"
)
for
i
in
range
(
tbnum
):
for
i
in
range
(
tbnum
):
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
-
5
}
)"
)
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
-
5
+
i
*
msec_per_min
}
)"
)
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
+
5
}
)"
)
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
+
5
+
i
*
msec_per_min
}
)"
)
self
.
diff_current_query
()
self
.
diff_current_query
()
self
.
diff_error_query
()
self
.
diff_error_query
()
tdLog
.
printNoPrefix
(
"######## insert data in the range near the max(bigint/double):"
)
tdLog
.
printNoPrefix
(
"######## insert data in the range near the max(bigint/double):"
)
self
.
diff_test_table
(
tbnum
)
self
.
diff_test_table
(
tbnum
)
tdSql
.
execute
(
f
"insert into db.t1(ts, c1,c2,c5,c7) values "
tdSql
.
execute
(
f
"insert into db.t1(ts, c1,c2,c5,c7) values "
f
"(
{
nowtime
-
(
per_table_rows
+
1
)
*
10
}
,
{
2
**
31
-
1
}
,
{
3.4
*
10
**
38
}
,
{
1.7
*
10
**
308
}
,
{
2
**
63
-
1
}
)"
)
f
"(
{
nowtime
-
(
per_table_rows
+
1
)
*
10
+
i
*
msec_per_min
}
,
{
2
**
31
-
1
}
,
{
3.4
*
10
**
38
}
,
{
1.7
*
10
**
308
}
,
{
2
**
63
-
1
}
)"
)
tdSql
.
execute
(
f
"insert into db.t1(ts, c1,c2,c5,c7) values "
tdSql
.
execute
(
f
"insert into db.t1(ts, c1,c2,c5,c7) values "
f
"(
{
nowtime
-
(
per_table_rows
+
2
)
*
10
}
,
{
2
**
31
-
1
}
,
{
3.4
*
10
**
38
}
,
{
1.7
*
10
**
308
}
,
{
2
**
63
-
1
}
)"
)
f
"(
{
nowtime
-
(
per_table_rows
+
2
)
*
10
+
i
*
msec_per_min
}
,
{
2
**
31
-
1
}
,
{
3.4
*
10
**
38
}
,
{
1.7
*
10
**
308
}
,
{
2
**
63
-
1
}
)"
)
self
.
diff_current_query
()
self
.
diff_current_query
()
self
.
diff_error_query
()
self
.
diff_error_query
()
tdLog
.
printNoPrefix
(
"######## insert data in the range near the min(bigint/double):"
)
tdLog
.
printNoPrefix
(
"######## insert data in the range near the min(bigint/double):"
)
self
.
diff_test_table
(
tbnum
)
self
.
diff_test_table
(
tbnum
)
tdSql
.
execute
(
f
"insert into db.t1(ts, c1,c2,c5,c7) values "
tdSql
.
execute
(
f
"insert into db.t1(ts, c1,c2,c5,c7) values "
f
"(
{
nowtime
-
(
per_table_rows
+
1
)
*
10
}
,
{
1
-
2
**
31
}
,
{
-
3.4
*
10
**
38
}
,
{
-
1.7
*
10
**
308
}
,
{
1
-
2
**
63
}
)"
)
f
"(
{
nowtime
-
(
per_table_rows
+
1
)
*
10
+
i
*
msec_per_min
}
,
{
1
-
2
**
31
}
,
{
-
3.4
*
10
**
38
}
,
{
-
1.7
*
10
**
308
}
,
{
1
-
2
**
63
}
)"
)
tdSql
.
execute
(
f
"insert into db.t1(ts, c1,c2,c5,c7) values "
tdSql
.
execute
(
f
"insert into db.t1(ts, c1,c2,c5,c7) values "
f
"(
{
nowtime
-
(
per_table_rows
+
2
)
*
10
}
,
{
1
-
2
**
31
}
,
{
-
3.4
*
10
**
38
}
,
{
-
1.7
*
10
**
308
}
,
{
512
-
2
**
63
}
)"
)
f
"(
{
nowtime
-
(
per_table_rows
+
2
)
*
10
+
i
*
msec_per_min
}
,
{
1
-
2
**
31
}
,
{
-
3.4
*
10
**
38
}
,
{
-
1.7
*
10
**
308
}
,
{
512
-
2
**
63
}
)"
)
self
.
diff_current_query
()
self
.
diff_current_query
()
self
.
diff_error_query
()
self
.
diff_error_query
()
...
@@ -426,9 +426,9 @@ class TDTestCase:
...
@@ -426,9 +426,9 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"######## insert data mix with NULL test:"
)
tdLog
.
printNoPrefix
(
"######## insert data mix with NULL test:"
)
for
i
in
range
(
tbnum
):
for
i
in
range
(
tbnum
):
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
}
)"
)
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
+
i
*
msec_per_min
}
)"
)
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
-
(
per_table_rows
+
3
)
*
10
}
)"
)
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
-
(
per_table_rows
+
3
)
*
10
+
i
*
msec_per_min
}
)"
)
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
+
(
per_table_rows
+
3
)
*
10
}
)"
)
tdSql
.
execute
(
f
"insert into db.t
{
i
}
(ts) values (
{
nowtime
+
(
per_table_rows
+
3
)
*
10
+
i
*
msec_per_min
}
)"
)
self
.
diff_current_query
()
self
.
diff_current_query
()
self
.
diff_error_query
()
self
.
diff_error_query
()
...
...
tests/system-test/2-query/irate.py
浏览文件 @
82baf3aa
...
@@ -34,7 +34,7 @@ class TDTestCase:
...
@@ -34,7 +34,7 @@ class TDTestCase:
ts
=
self
.
ts
ts
=
self
.
ts
for
row
in
range
(
rownums
):
for
row
in
range
(
rownums
):
ts
=
self
.
ts
+
time_step
*
row
ts
=
self
.
ts
+
(
time_step
)
*
row
+
tbnum
*
60
*
1000
c1
=
random
.
randint
(
0
,
1000
)
c1
=
random
.
randint
(
0
,
1000
)
c2
=
random
.
randint
(
0
,
100000
)
c2
=
random
.
randint
(
0
,
100000
)
c3
=
random
.
randint
(
0
,
125
)
c3
=
random
.
randint
(
0
,
125
)
...
...
tests/system-test/2-query/mavg.py
浏览文件 @
82baf3aa
...
@@ -26,6 +26,7 @@ from util.sql import *
...
@@ -26,6 +26,7 @@ from util.sql import *
from
util.dnodes
import
*
from
util.dnodes
import
*
dbname
=
'db'
dbname
=
'db'
msec_per_min
=
60
*
1000
class
TDTestCase
:
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
,
replicaVar
=
1
):
def
init
(
self
,
conn
,
logSql
,
replicaVar
=
1
):
self
.
replicaVar
=
int
(
replicaVar
)
self
.
replicaVar
=
int
(
replicaVar
)
...
@@ -327,7 +328,7 @@ class TDTestCase:
...
@@ -327,7 +328,7 @@ class TDTestCase:
self
.
checkmavg
(
**
case6
)
self
.
checkmavg
(
**
case6
)
# case7~8: nested query
# case7~8: nested query
case7
=
{
"table_expr"
:
f
"(select c1 from
{
dbname
}
.stb1)"
}
case7
=
{
"table_expr"
:
f
"(select
ts,
c1 from
{
dbname
}
.stb1)"
}
self
.
checkmavg
(
**
case7
)
self
.
checkmavg
(
**
case7
)
# case8 = {"table_expr": f"(select _c0, mavg(c1, 1) c1 from {dbname}.stb1 group by tbname)"}
# case8 = {"table_expr": f"(select _c0, mavg(c1, 1) c1 from {dbname}.stb1 group by tbname)"}
# self.checkmavg(**case8)
# self.checkmavg(**case8)
...
@@ -568,19 +569,19 @@ class TDTestCase:
...
@@ -568,19 +569,19 @@ class TDTestCase:
for
j
in
range
(
data_row
):
for
j
in
range
(
data_row
):
tdSql
.
execute
(
tdSql
.
execute
(
f
"insert into
{
dbname
}
.t
{
i
}
values ("
f
"insert into
{
dbname
}
.t
{
i
}
values ("
f
"
{
basetime
+
(
j
+
1
)
*
10
}
,
{
random
.
randint
(
-
200
,
-
1
)
}
,
{
random
.
uniform
(
200
,
-
1
)
}
,
{
basetime
+
random
.
randint
(
-
200
,
-
1
)
}
, "
f
"
{
basetime
+
(
j
+
1
)
*
10
+
i
*
msec_per_min
}
,
{
random
.
randint
(
-
200
,
-
1
)
}
,
{
random
.
uniform
(
200
,
-
1
)
}
,
{
basetime
+
random
.
randint
(
-
200
,
-
1
)
}
, "
f
"'binary_
{
j
}
',
{
random
.
uniform
(
-
200
,
-
1
)
}
,
{
random
.
choice
([
0
,
1
])
}
,
{
random
.
randint
(
-
200
,
-
1
)
}
, "
f
"'binary_
{
j
}
',
{
random
.
uniform
(
-
200
,
-
1
)
}
,
{
random
.
choice
([
0
,
1
])
}
,
{
random
.
randint
(
-
200
,
-
1
)
}
, "
f
"
{
random
.
randint
(
-
200
,
-
1
)
}
,
{
random
.
randint
(
-
127
,
-
1
)
}
, 'nchar_
{
j
}
' )"
f
"
{
random
.
randint
(
-
200
,
-
1
)
}
,
{
random
.
randint
(
-
127
,
-
1
)
}
, 'nchar_
{
j
}
' )"
)
)
tdSql
.
execute
(
tdSql
.
execute
(
f
"insert into
{
dbname
}
.t
{
i
}
values ("
f
"insert into
{
dbname
}
.t
{
i
}
values ("
f
"
{
basetime
-
(
j
+
1
)
*
10
}
,
{
random
.
randint
(
1
,
200
)
}
,
{
random
.
uniform
(
1
,
200
)
}
,
{
basetime
-
random
.
randint
(
1
,
200
)
}
, "
f
"
{
basetime
-
(
j
+
1
)
*
10
+
i
*
msec_per_min
}
,
{
random
.
randint
(
1
,
200
)
}
,
{
random
.
uniform
(
1
,
200
)
}
,
{
basetime
-
random
.
randint
(
1
,
200
)
}
, "
f
"'binary_
{
j
}
_1',
{
random
.
uniform
(
1
,
200
)
}
,
{
random
.
choice
([
0
,
1
])
}
,
{
random
.
randint
(
1
,
200
)
}
, "
f
"'binary_
{
j
}
_1',
{
random
.
uniform
(
1
,
200
)
}
,
{
random
.
choice
([
0
,
1
])
}
,
{
random
.
randint
(
1
,
200
)
}
, "
f
"
{
random
.
randint
(
1
,
200
)
}
,
{
random
.
randint
(
1
,
127
)
}
, 'nchar_
{
j
}
_1' )"
f
"
{
random
.
randint
(
1
,
200
)
}
,
{
random
.
randint
(
1
,
127
)
}
, 'nchar_
{
j
}
_1' )"
)
)
tdSql
.
execute
(
tdSql
.
execute
(
f
"insert into
{
dbname
}
.tt
{
i
}
values (
{
basetime
-
(
j
+
1
)
*
10
}
,
{
random
.
randint
(
1
,
200
)
}
)"
f
"insert into
{
dbname
}
.tt
{
i
}
values (
{
basetime
-
(
j
+
1
)
*
10
+
i
*
msec_per_min
}
,
{
random
.
randint
(
1
,
200
)
}
)"
)
)
pass
pass
...
@@ -619,8 +620,8 @@ class TDTestCase:
...
@@ -619,8 +620,8 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"######## insert only NULL test:"
)
tdLog
.
printNoPrefix
(
"######## insert only NULL test:"
)
for
i
in
range
(
tbnum
):
for
i
in
range
(
tbnum
):
tdSql
.
execute
(
f
"insert into
{
dbname
}
.t
{
i
}
(ts) values (
{
nowtime
-
5
}
)"
)
tdSql
.
execute
(
f
"insert into
{
dbname
}
.t
{
i
}
(ts) values (
{
nowtime
-
5
+
i
*
msec_per_min
}
)"
)
tdSql
.
execute
(
f
"insert into
{
dbname
}
.t
{
i
}
(ts) values (
{
nowtime
+
5
}
)"
)
tdSql
.
execute
(
f
"insert into
{
dbname
}
.t
{
i
}
(ts) values (
{
nowtime
+
5
+
i
*
msec_per_min
}
)"
)
self
.
mavg_current_query
()
self
.
mavg_current_query
()
self
.
mavg_error_query
()
self
.
mavg_error_query
()
...
@@ -651,9 +652,9 @@ class TDTestCase:
...
@@ -651,9 +652,9 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"######## insert data mix with NULL test:"
)
tdLog
.
printNoPrefix
(
"######## insert data mix with NULL test:"
)
for
i
in
range
(
tbnum
):
for
i
in
range
(
tbnum
):
tdSql
.
execute
(
f
"insert into
{
dbname
}
.t
{
i
}
(ts) values (
{
nowtime
}
)"
)
tdSql
.
execute
(
f
"insert into
{
dbname
}
.t
{
i
}
(ts) values (
{
nowtime
+
i
*
msec_per_min
}
)"
)
tdSql
.
execute
(
f
"insert into
{
dbname
}
.t
{
i
}
(ts) values (
{
nowtime
-
(
per_table_rows
+
3
)
*
10
}
)"
)
tdSql
.
execute
(
f
"insert into
{
dbname
}
.t
{
i
}
(ts) values (
{
nowtime
-
(
per_table_rows
+
3
)
*
10
+
i
*
msec_per_min
}
)"
)
tdSql
.
execute
(
f
"insert into
{
dbname
}
.t
{
i
}
(ts) values (
{
nowtime
+
(
per_table_rows
+
3
)
*
10
}
)"
)
tdSql
.
execute
(
f
"insert into
{
dbname
}
.t
{
i
}
(ts) values (
{
nowtime
+
(
per_table_rows
+
3
)
*
10
+
i
*
msec_per_min
}
)"
)
self
.
mavg_current_query
()
self
.
mavg_current_query
()
self
.
mavg_error_query
()
self
.
mavg_error_query
()
...
@@ -676,7 +677,7 @@ class TDTestCase:
...
@@ -676,7 +677,7 @@ class TDTestCase:
tdSql
.
checkRows
(
4
)
tdSql
.
checkRows
(
4
)
def
mavg_support_stable
(
self
):
def
mavg_support_stable
(
self
):
tdSql
.
query
(
f
"
select mavg(1,3) from
{
dbname
}
.stb1 "
)
tdSql
.
query
(
f
"select mavg(1,3) from
{
dbname
}
.stb1 "
)
tdSql
.
checkRows
(
68
)
tdSql
.
checkRows
(
68
)
tdSql
.
checkData
(
0
,
0
,
1.000000000
)
tdSql
.
checkData
(
0
,
0
,
1.000000000
)
tdSql
.
query
(
f
"select mavg(c1,3) from
{
dbname
}
.stb1 partition by tbname "
)
tdSql
.
query
(
f
"select mavg(c1,3) from
{
dbname
}
.stb1 partition by tbname "
)
...
...
tests/system-test/2-query/max_partition.py
浏览文件 @
82baf3aa
...
@@ -20,15 +20,15 @@ class TDTestCase:
...
@@ -20,15 +20,15 @@ class TDTestCase:
for
i
in
range
(
tb_nums
):
for
i
in
range
(
tb_nums
):
tbname
=
f
"
{
dbname
}
.sub_
{
stb_name
}
_
{
i
}
"
tbname
=
f
"
{
dbname
}
.sub_
{
stb_name
}
_
{
i
}
"
ts
=
self
.
ts
+
i
*
10000
ts
=
self
.
ts
+
i
*
1000
*
12
0
tdSql
.
execute
(
f
"create table
{
tbname
}
using
{
dbname
}
.
{
stb_name
}
tags (
{
ts
}
,
{
i
}
,
{
i
}
*10 ,
{
i
}
*1.0,
{
i
}
*1.0 , 1 , 2, 'true', 'binary_
{
i
}
' ,'nchar_
{
i
}
',
{
i
}
,
{
i
}
,10,20 )"
)
tdSql
.
execute
(
f
"create table
{
tbname
}
using
{
dbname
}
.
{
stb_name
}
tags (
{
ts
}
,
{
i
}
,
{
i
}
*10 ,
{
i
}
*1.0,
{
i
}
*1.0 , 1 , 2, 'true', 'binary_
{
i
}
' ,'nchar_
{
i
}
',
{
i
}
,
{
i
}
,10,20 )"
)
for
row
in
range
(
row_nums
):
for
row
in
range
(
row_nums
):
ts
=
self
.
ts
+
row
*
1000
ts
=
ts
+
row
*
1000
tdSql
.
execute
(
f
"insert into
{
tbname
}
values(
{
ts
}
,
{
row
}
,
{
row
}
,
{
row
}
,
{
row
}
, 1 , 2 , 'true' , 'binary_
{
row
}
' , 'nchar_
{
row
}
' ,
{
row
}
,
{
row
}
, 1 ,2 )"
)
tdSql
.
execute
(
f
"insert into
{
tbname
}
values(
{
ts
}
,
{
row
}
,
{
row
}
,
{
row
}
,
{
row
}
, 1 , 2 , 'true' , 'binary_
{
row
}
' , 'nchar_
{
row
}
' ,
{
row
}
,
{
row
}
, 1 ,2 )"
)
for
null
in
range
(
5
):
for
null
in
range
(
5
):
ts
=
self
.
ts
+
row_nums
*
1000
+
null
*
1000
ts
=
ts
+
row_nums
*
1000
+
null
*
1000
tdSql
.
execute
(
f
"insert into
{
tbname
}
values(
{
ts
}
, NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL )"
)
tdSql
.
execute
(
f
"insert into
{
tbname
}
values(
{
ts
}
, NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL )"
)
def
basic_query
(
self
,
dbname
=
"db"
):
def
basic_query
(
self
,
dbname
=
"db"
):
...
@@ -160,13 +160,13 @@ class TDTestCase:
...
@@ -160,13 +160,13 @@ class TDTestCase:
tdSql
.
query
(
f
"select tbname , count(c1) from
{
dbname
}
.stb partition by tbname interval(10s) slimit 5 soffset 1 "
)
tdSql
.
query
(
f
"select tbname , count(c1) from
{
dbname
}
.stb partition by tbname interval(10s) slimit 5 soffset 1 "
)
tdSql
.
query
(
f
"select tbname , max(c1) from
{
dbname
}
.stb partition by tbname interval(10s)"
)
tdSql
.
query
(
f
"select tbname , max(c1) from
{
dbname
}
.stb partition by tbname interval(10s)"
)
tdSql
.
checkRows
(
self
.
row_nums
*
2
)
tdSql
.
checkRows
(
self
.
row_nums
*
10
)
tdSql
.
query
(
f
"select unique(c1) from
{
dbname
}
.stb partition by tbname order by tbname"
)
tdSql
.
query
(
f
"select unique(c1) from
{
dbname
}
.stb partition by tbname order by tbname"
)
tdSql
.
query
(
f
"select tbname , count(c1) from
{
dbname
}
.sub_stb_1 partition by tbname interval(10s)"
)
tdSql
.
query
(
f
"select tbname , count(c1) from
{
dbname
}
.sub_stb_1 partition by tbname interval(10s)"
)
tdSql
.
checkData
(
0
,
0
,
'sub_stb_1'
)
tdSql
.
checkData
(
0
,
0
,
'sub_stb_1'
)
tdSql
.
checkData
(
0
,
1
,
self
.
row_nums
)
tdSql
.
checkData
(
0
,
1
,
4
)
tdSql
.
query
(
f
"select c1 , mavg(c1 ,2 ) from
{
dbname
}
.stb partition by c1"
)
tdSql
.
query
(
f
"select c1 , mavg(c1 ,2 ) from
{
dbname
}
.stb partition by c1"
)
tdSql
.
checkRows
(
90
)
tdSql
.
checkRows
(
90
)
...
@@ -193,7 +193,7 @@ class TDTestCase:
...
@@ -193,7 +193,7 @@ class TDTestCase:
tdSql
.
query
(
f
"select c1 , DERIVATIVE(c1,2,1) from
{
dbname
}
.stb partition by c1 order by c1"
)
tdSql
.
query
(
f
"select c1 , DERIVATIVE(c1,2,1) from
{
dbname
}
.stb partition by c1 order by c1"
)
tdSql
.
checkRows
(
90
)
tdSql
.
checkRows
(
90
)
# bug need fix
# bug need fix
tdSql
.
checkData
(
0
,
1
,
None
)
tdSql
.
checkData
(
0
,
1
,
0.0
)
tdSql
.
query
(
f
"select tbname , max(c1) from
{
dbname
}
.stb partition by tbname order by tbname slimit 5 soffset 0 "
)
tdSql
.
query
(
f
"select tbname , max(c1) from
{
dbname
}
.stb partition by tbname order by tbname slimit 5 soffset 0 "
)
...
...
tests/system-test/2-query/nestedQuery.py
浏览文件 @
82baf3aa
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
tests/system-test/2-query/stablity.py
浏览文件 @
82baf3aa
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
tests/system-test/2-query/stablity_1.py
浏览文件 @
82baf3aa
...
@@ -17,52 +17,52 @@ class TDTestCase(TDTestCase):
...
@@ -17,52 +17,52 @@ class TDTestCase(TDTestCase):
def
run
(
self
):
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
prepare
()
startTime
=
time
.
time
()
self
.
function_before_26
()
startTime
=
time
.
time
()
self
.
dropandcreateDB_random
(
"%s"
%
self
.
db_nest
,
1
)
self
.
function_before_26
()
self
.
dropandcreateDB_random
(
"%s"
%
self
.
db_nest
,
1
)
# self.math_nest(['UNIQUE'])
# self.math_nest(['UNIQUE'])
# self.math_nest(['MODE'])
# self.math_nest(['MODE'])
# self.math_nest(['SAMPLE'])
# self.math_nest(['SAMPLE'])
# self.math_nest(['ABS','SQRT'])
# self.math_nest(['ABS','SQRT'])
# self.math_nest(['SIN','COS','TAN','ASIN','ACOS','ATAN'])
# self.math_nest(['SIN','COS','TAN','ASIN','ACOS','ATAN'])
# self.math_nest(['POW','LOG'])
# self.math_nest(['POW','LOG'])
# self.math_nest(['FLOOR','CEIL','ROUND'])
# self.math_nest(['FLOOR','CEIL','ROUND'])
# self.math_nest(['MAVG'])
# self.math_nest(['MAVG'])
# self.math_nest(['HYPERLOGLOG'])
# self.math_nest(['HYPERLOGLOG'])
# self.math_nest(['TAIL'])
# self.math_nest(['TAIL'])
# self.math_nest(['CSUM'])
# self.math_nest(['CSUM'])
# self.math_nest(['statecount','stateduration'])
# self.math_nest(['statecount','stateduration'])
# self.math_nest(['HISTOGRAM'])
# self.math_nest(['HISTOGRAM'])
self
.
str_nest
([
'LTRIM'
,
'RTRIM'
,
'LOWER'
,
'UPPER'
])
self
.
str_nest
([
'LTRIM'
,
'RTRIM'
,
'LOWER'
,
'UPPER'
])
self
.
str_nest
([
'LENGTH'
,
'CHAR_LENGTH'
])
self
.
str_nest
([
'LENGTH'
,
'CHAR_LENGTH'
])
self
.
str_nest
([
'SUBSTR'
])
self
.
str_nest
([
'SUBSTR'
])
self
.
str_nest
([
'CONCAT'
])
self
.
str_nest
([
'CONCAT'
])
self
.
str_nest
([
'CONCAT_WS'
])
self
.
str_nest
([
'CONCAT_WS'
])
self
.
time_nest
([
'CAST'
])
self
.
time_nest
([
'CAST'
])
self
.
time_nest
([
'CAST_1'
])
self
.
time_nest
([
'CAST_1'
])
self
.
time_nest
([
'CAST_2'
])
self
.
time_nest
([
'CAST_2'
])
self
.
time_nest
([
'CAST_3'
])
self
.
time_nest
([
'CAST_3'
])
self
.
time_nest
([
'CAST_4'
])
self
.
time_nest
([
'CAST_4'
])
self
.
time_nest
([
'NOW'
,
'TODAY'
])
self
.
time_nest
([
'NOW'
,
'TODAY'
])
self
.
time_nest
([
'TIMEZONE'
])
self
.
time_nest
([
'TIMEZONE'
])
self
.
time_nest
([
'TIMETRUNCATE'
])
self
.
time_nest
([
'TIMETRUNCATE'
])
self
.
time_nest
([
'TO_ISO8601'
])
self
.
time_nest
([
'TO_ISO8601'
])
self
.
time_nest
([
'TO_UNIXTIMESTAMP'
])
self
.
time_nest
([
'TO_UNIXTIMESTAMP'
])
self
.
time_nest
([
'ELAPSED'
])
self
.
time_nest
([
'ELAPSED'
])
self
.
time_nest
([
'TIMEDIFF_1'
])
self
.
time_nest
([
'TIMEDIFF_1'
])
self
.
time_nest
([
'TIMEDIFF_2'
])
self
.
time_nest
([
'TIMEDIFF_2'
])
endTime
=
time
.
time
()
endTime
=
time
.
time
()
print
(
"total time %ds"
%
(
endTime
-
startTime
))
print
(
"total time %ds"
%
(
endTime
-
startTime
))
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录