Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
acc27d46
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
acc27d46
编写于
7月 15, 2022
作者:
C
cpwu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix case
上级
6d717b45
变更
9
展开全部
显示空白变更内容
内联
并排
Showing
9 changed file
with
588 addition
and
553 deletion
+588
-553
tests/pytest/util/sql.py
tests/pytest/util/sql.py
+11
-3
tests/system-test/2-query/abs.py
tests/system-test/2-query/abs.py
+193
-180
tests/system-test/2-query/and_or_for_byte.py
tests/system-test/2-query/and_or_for_byte.py
+133
-130
tests/system-test/2-query/apercentile.py
tests/system-test/2-query/apercentile.py
+4
-3
tests/system-test/2-query/arccos.py
tests/system-test/2-query/arccos.py
+201
-201
tests/system-test/2-query/histogram.py
tests/system-test/2-query/histogram.py
+0
-1
tests/system-test/2-query/join.py
tests/system-test/2-query/join.py
+3
-3
tests/system-test/2-query/sum.py
tests/system-test/2-query/sum.py
+29
-25
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+14
-7
未找到文件。
tests/pytest/util/sql.py
浏览文件 @
acc27d46
...
...
@@ -217,9 +217,17 @@ class TDSql:
tdLog
.
info
(
"sql:%s, row:%d col:%d data:%s == expect:%s"
%
(
self
.
sql
,
row
,
col
,
self
.
queryResult
[
row
][
col
],
data
))
return
elif
isinstance
(
data
,
float
)
and
abs
(
self
.
queryResult
[
row
][
col
]
-
data
)
<=
0.000001
:
elif
isinstance
(
data
,
float
):
if
abs
(
data
)
>=
1
and
abs
((
self
.
queryResult
[
row
][
col
]
-
data
)
/
data
)
<=
0.000001
:
tdLog
.
info
(
"sql:%s, row:%d col:%d data:%f == expect:%f"
%
(
self
.
sql
,
row
,
col
,
self
.
queryResult
[
row
][
col
],
data
))
elif
abs
(
data
)
<
1
and
abs
(
self
.
queryResult
[
row
][
col
]
-
data
)
<=
0.000001
:
tdLog
.
info
(
"sql:%s, row:%d col:%d data:%f == expect:%f"
%
(
self
.
sql
,
row
,
col
,
self
.
queryResult
[
row
][
col
],
data
))
else
:
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
1
][
0
])
args
=
(
caller
.
filename
,
caller
.
lineno
,
self
.
sql
,
row
,
col
,
self
.
queryResult
[
row
][
col
],
data
)
tdLog
.
exit
(
"%s(%d) failed: sql:%s row:%d col:%d data:%s != expect:%s"
%
args
)
return
else
:
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
1
][
0
])
...
...
tests/system-test/2-query/abs.py
浏览文件 @
acc27d46
此差异已折叠。
点击以展开。
tests/system-test/2-query/and_or_for_byte.py
浏览文件 @
acc27d46
此差异已折叠。
点击以展开。
tests/system-test/2-query/apercentile.py
浏览文件 @
acc27d46
...
...
@@ -20,12 +20,13 @@ from util.sqlset import TDSetSql
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
tdSql
.
init
(
conn
.
cursor
(),
False
)
self
.
rowNum
=
10
self
.
ts
=
1537146000000
self
.
setsql
=
TDSetSql
()
self
.
ntbname
=
'ntb'
self
.
stbname
=
'stb'
self
.
dbname
=
"db"
self
.
ntbname
=
f
"
{
self
.
dbname
}
.ntb"
self
.
stbname
=
f
'
{
self
.
dbname
}
.stb'
self
.
binary_length
=
20
# the length of binary for column_dict
self
.
nchar_length
=
20
# the length of nchar for column_dict
self
.
column_dict
=
{
...
...
tests/system-test/2-query/arccos.py
浏览文件 @
acc27d46
此差异已折叠。
点击以展开。
tests/system-test/2-query/histogram.py
浏览文件 @
acc27d46
...
...
@@ -5,7 +5,6 @@ import json
from
dataclasses
import
dataclass
,
field
from
typing
import
List
,
Any
,
Tuple
from
certifi
import
where
from
util.log
import
tdLog
from
util.sql
import
tdSql
from
util.cases
import
tdCases
...
...
tests/system-test/2-query/join.py
浏览文件 @
acc27d46
...
...
@@ -380,9 +380,9 @@ class TDTestCase:
tdSql
.
query
(
"select count(*) from ct1"
)
tdSql
.
checkData
(
0
,
0
,
self
.
rows
)
#
tdSql.execute("flush database db")
tdDnodes
.
stop
(
1
)
tdDnodes
.
start
(
1
)
tdSql
.
execute
(
"flush database db"
)
#
tdDnodes.stop(1)
#
tdDnodes.start(1)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count(*) from ct1"
)
...
...
tests/system-test/2-query/sum.py
浏览文件 @
acc27d46
...
...
@@ -20,6 +20,8 @@ NUM_COL = [INT_COL, BINT_COL, SINT_COL, TINT_COL, FLOAT_COL, DOUBLE_COL, ]
UN_NUM_COL
=
[
BOOL_COL
,
BINARY_COL
,
NCHAR_COL
,
]
TS_TYPE_COL
=
[
TS_COL
]
DBNAME
=
"db"
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
...
...
@@ -54,14 +56,14 @@ class TDTestCase:
where_condition
=
self
.
__where_condition
(
condition
)
group_condition
=
self
.
__group_condition
(
condition
,
having
=
f
"
{
condition
}
is not null "
)
tdSql
.
query
(
f
"select
{
condition
}
from
{
tbname
}
{
where_condition
}
"
)
tdSql
.
query
(
f
"select
{
condition
}
from
{
DBNAME
}
.
{
tbname
}
{
where_condition
}
"
)
datas
=
[
tdSql
.
getData
(
i
,
0
)
for
i
in
range
(
tdSql
.
queryRows
)]
sum_data
=
sum
(
filter
(
None
,
datas
))
tdSql
.
query
(
f
"select sum(
{
condition
}
) from
{
tbname
}
{
where_condition
}
"
)
tdSql
.
query
(
f
"select sum(
{
condition
}
) from
{
DBNAME
}
.
{
tbname
}
{
where_condition
}
"
)
tdSql
.
checkData
(
0
,
0
,
sum_data
)
tdSql
.
query
(
f
"select
{
condition
}
from
{
tbname
}
{
where_condition
}
{
group_condition
}
"
)
tdSql
.
query
(
f
"select sum(
{
condition
}
) from
{
tbname
}
{
where_condition
}
{
group_condition
}
"
)
tdSql
.
query
(
f
"select
{
condition
}
from
{
DBNAME
}
.
{
tbname
}
{
where_condition
}
{
group_condition
}
"
)
tdSql
.
query
(
f
"select sum(
{
condition
}
) from
{
DBNAME
}
.
{
tbname
}
{
where_condition
}
{
group_condition
}
"
)
def
__sum_err_check
(
self
,
tbanme
):
sqls
=
[]
...
...
@@ -69,19 +71,19 @@ class TDTestCase:
for
un_num_col
in
UN_NUM_COL
:
sqls
.
extend
(
(
f
"select sum(
{
un_num_col
}
) from
{
tbanme
}
"
,
f
"select sum(ceil(
{
un_num_col
}
)) from
{
tbanme
}
"
,
f
"select sum(
{
un_num_col
}
) from
{
DBNAME
}
.
{
tbanme
}
"
,
f
"select sum(ceil(
{
un_num_col
}
))
{
DBNAME
}
.
from
{
tbanme
}
"
,
)
)
# sqls.extend( f"select sum( {un_num_col} + {un_num_col_2} ) from {tbanme} " for un_num_col_2 in UN_NUM_COL )
sqls
.
extend
(
f
"select sum(
{
num_col
}
+
{
ts_col
}
) from
{
tbanme
}
"
for
num_col
in
NUM_COL
for
ts_col
in
TS_TYPE_COL
)
sqls
.
extend
(
f
"select sum(
{
num_col
}
+
{
ts_col
}
) from
{
DBNAME
}
.
{
tbanme
}
"
for
num_col
in
NUM_COL
for
ts_col
in
TS_TYPE_COL
)
sqls
.
extend
(
(
f
"select sum() from
{
tbanme
}
"
,
f
"select sum(*) from
{
tbanme
}
"
,
f
"select sum(ccccccc) from
{
tbanme
}
"
,
f
"select sum('test') from
{
tbanme
}
"
,
f
"select sum() from
{
DBNAME
}
.
{
tbanme
}
"
,
f
"select sum(*) from
{
DBNAME
}
.
{
tbanme
}
"
,
f
"select sum(ccccccc)
{
DBNAME
}
.
from
{
tbanme
}
"
,
f
"select sum('test') from
{
DBNAME
}
.
{
tbanme
}
"
,
)
)
...
...
@@ -110,16 +112,15 @@ class TDTestCase:
def
__create_tb
(
self
):
tdSql
.
prepare
()
tdLog
.
printNoPrefix
(
"==========step1:create table"
)
create_stb_sql
=
f
'''create table stb1(
create_stb_sql
=
f
'''create table
{
DBNAME
}
.
stb1(
ts timestamp,
{
INT_COL
}
int,
{
BINT_COL
}
bigint,
{
SINT_COL
}
smallint,
{
TINT_COL
}
tinyint,
{
FLOAT_COL
}
float,
{
DOUBLE_COL
}
double,
{
BOOL_COL
}
bool,
{
BINARY_COL
}
binary(16),
{
NCHAR_COL
}
nchar(32),
{
TS_COL
}
timestamp
) tags (t1 int)
'''
create_ntb_sql
=
f
'''create table t1(
create_ntb_sql
=
f
'''create table
{
DBNAME
}
.
t1(
ts timestamp,
{
INT_COL
}
int,
{
BINT_COL
}
bigint,
{
SINT_COL
}
smallint,
{
TINT_COL
}
tinyint,
{
FLOAT_COL
}
float,
{
DOUBLE_COL
}
double,
{
BOOL_COL
}
bool,
{
BINARY_COL
}
binary(16),
{
NCHAR_COL
}
nchar(32),
{
TS_COL
}
timestamp
...
...
@@ -129,29 +130,29 @@ class TDTestCase:
tdSql
.
execute
(
create_ntb_sql
)
for
i
in
range
(
4
):
tdSql
.
execute
(
f
'create table
ct
{
i
+
1
}
using
stb1 tags (
{
i
+
1
}
)'
)
tdSql
.
execute
(
f
'create table
{
DBNAME
}
.ct
{
i
+
1
}
using
{
DBNAME
}
.
stb1 tags (
{
i
+
1
}
)'
)
def
__insert_data
(
self
,
rows
):
now_time
=
int
(
datetime
.
datetime
.
timestamp
(
datetime
.
datetime
.
now
())
*
1000
)
for
i
in
range
(
rows
):
tdSql
.
execute
(
f
"insert into ct1 values (
{
now_time
-
i
*
1000
}
,
{
i
}
,
{
11111
*
i
}
,
{
111
*
i
%
32767
}
,
{
11
*
i
%
127
}
,
{
1.11
*
i
}
,
{
1100.0011
*
i
}
,
{
i
%
2
}
, 'binary
{
i
}
', 'nchar
{
i
}
',
{
now_time
+
1
*
i
}
)"
f
"insert into
{
DBNAME
}
.
ct1 values (
{
now_time
-
i
*
1000
}
,
{
i
}
,
{
11111
*
i
}
,
{
111
*
i
%
32767
}
,
{
11
*
i
%
127
}
,
{
1.11
*
i
}
,
{
1100.0011
*
i
}
,
{
i
%
2
}
, 'binary
{
i
}
', 'nchar
{
i
}
',
{
now_time
+
1
*
i
}
)"
)
tdSql
.
execute
(
f
"insert into ct4 values (
{
now_time
-
i
*
7776000000
}
,
{
i
}
,
{
11111
*
i
}
,
{
111
*
i
%
32767
}
,
{
11
*
i
%
127
}
,
{
1.11
*
i
}
,
{
1100.0011
*
i
}
,
{
i
%
2
}
, 'binary
{
i
}
', 'nchar
{
i
}
',
{
now_time
+
1
*
i
}
)"
f
"insert into
{
DBNAME
}
.
ct4 values (
{
now_time
-
i
*
7776000000
}
,
{
i
}
,
{
11111
*
i
}
,
{
111
*
i
%
32767
}
,
{
11
*
i
%
127
}
,
{
1.11
*
i
}
,
{
1100.0011
*
i
}
,
{
i
%
2
}
, 'binary
{
i
}
', 'nchar
{
i
}
',
{
now_time
+
1
*
i
}
)"
)
tdSql
.
execute
(
f
"insert into ct2 values (
{
now_time
-
i
*
7776000000
}
,
{
-
i
}
,
{
-
11111
*
i
}
,
{
-
111
*
i
%
32767
}
,
{
-
11
*
i
%
127
}
,
{
-
1.11
*
i
}
,
{
-
1100.0011
*
i
}
,
{
i
%
2
}
, 'binary
{
i
}
', 'nchar
{
i
}
',
{
now_time
+
1
*
i
}
)"
f
"insert into
{
DBNAME
}
.
ct2 values (
{
now_time
-
i
*
7776000000
}
,
{
-
i
}
,
{
-
11111
*
i
}
,
{
-
111
*
i
%
32767
}
,
{
-
11
*
i
%
127
}
,
{
-
1.11
*
i
}
,
{
-
1100.0011
*
i
}
,
{
i
%
2
}
, 'binary
{
i
}
', 'nchar
{
i
}
',
{
now_time
+
1
*
i
}
)"
)
tdSql
.
execute
(
f
'''insert into ct1 values
f
'''insert into
{
DBNAME
}
.
ct1 values
(
{
now_time
-
rows
*
5
}
, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0',
{
now_time
+
8
}
)
(
{
now_time
+
10000
}
,
{
rows
}
, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9',
{
now_time
+
9
}
)
'''
)
tdSql
.
execute
(
f
'''insert into ct4 values
f
'''insert into
{
DBNAME
}
.
ct4 values
(
{
now_time
-
rows
*
7776000000
}
, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
(
{
now_time
-
rows
*
3888000000
+
10800000
}
, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
(
{
now_time
+
7776000000
}
, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
...
...
@@ -167,7 +168,7 @@ class TDTestCase:
)
tdSql
.
execute
(
f
'''insert into ct2 values
f
'''insert into
{
DBNAME
}
.
ct2 values
(
{
now_time
-
rows
*
7776000000
}
, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
(
{
now_time
-
rows
*
3888000000
+
10800000
}
, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
(
{
now_time
+
7776000000
}
, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
...
...
@@ -183,13 +184,13 @@ class TDTestCase:
)
for
i
in
range
(
rows
):
insert_data
=
f
'''insert into t1 values
insert_data
=
f
'''insert into
{
DBNAME
}
.
t1 values
(
{
now_time
-
i
*
3600000
}
,
{
i
}
,
{
i
*
11111
}
,
{
i
%
32767
}
,
{
i
%
127
}
,
{
i
*
1.11111
}
,
{
i
*
1000.1111
}
,
{
i
%
2
}
,
"binary_
{
i
}
", "nchar_
{
i
}
",
{
now_time
-
1000
*
i
}
)
'''
tdSql
.
execute
(
insert_data
)
tdSql
.
execute
(
f
'''insert into t1 values
f
'''insert into
{
DBNAME
}
.
t1 values
(
{
now_time
+
10800000
}
, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
(
{
now_time
-
((
rows
//
2
)
*
60
+
30
)
*
60000
}
, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
(
{
now_time
-
rows
*
3600000
}
, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
...
...
@@ -218,8 +219,11 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"==========step3:all check"
)
self
.
all_test
()
tdDnodes
.
stop
(
1
)
tdDnodes
.
start
(
1
)
# tdDnodes.stop(1)
# tdDnodes.start(1)
tdSql
.
execute
(
"flush database db"
)
tdSql
.
execute
(
"use db"
)
...
...
tests/system-test/fulltest.sh
浏览文件 @
acc27d46
...
...
@@ -29,6 +29,17 @@ python3 ./test.py -f 1-insert/block_wise.py
python3 ./test.py
-f
1-insert/create_retentions.py
python3 ./test.py
-f
1-insert/table_param_ttl.py
python3 ./test.py
-f
2-query/abs.py
python3 ./test.py
-f
2-query/abs.py
-R
python3 ./test.py
-f
2-query/and_or_for_byte.py
python3 ./test.py
-f
2-query/and_or_for_byte.py
-R
python3 ./test.py
-f
2-query/apercentile.py
python3 ./test.py
-f
2-query/apercentile.py
-R
python3 ./test.py
-f
2-query/arccos.py
python3 ./test.py
-f
2-query/arccos.py
-R
python3 ./test.py
-f
2-query/between.py
python3 ./test.py
-f
2-query/distinct.py
python3 ./test.py
-f
2-query/varchar.py
...
...
@@ -74,8 +85,6 @@ python3 ./test.py -f 2-query/json_tag.py
python3 ./test.py
-f
2-query/top.py
python3 ./test.py
-f
2-query/bottom.py
python3 ./test.py
-f
2-query/percentile.py
python3 ./test.py
-f
2-query/apercentile.py
python3 ./test.py
-f
2-query/abs.py
python3 ./test.py
-f
2-query/ceil.py
python3 ./test.py
-f
2-query/floor.py
python3 ./test.py
-f
2-query/round.py
...
...
@@ -86,7 +95,6 @@ python3 ./test.py -f 2-query/sin.py
python3 ./test.py
-f
2-query/cos.py
python3 ./test.py
-f
2-query/tan.py
python3 ./test.py
-f
2-query/arcsin.py
python3 ./test.py
-f
2-query/arccos.py
python3 ./test.py
-f
2-query/arctan.py
python3 ./test.py
-f
2-query/query_cols_tags_and_or.py
# python3 ./test.py -f 2-query/nestedQuery.py
...
...
@@ -117,7 +125,6 @@ python3 ./test.py -f 2-query/distribute_agg_avg.py
python3 ./test.py
-f
2-query/distribute_agg_stddev.py
python3 ./test.py
-f
2-query/twa.py
python3 ./test.py
-f
2-query/irate.py
python3 ./test.py
-f
2-query/and_or_for_byte.py
python3 ./test.py
-f
2-query/count_partition.py
python3 ./test.py
-f
2-query/function_null.py
python3 ./test.py
-f
2-query/queryQnode.py
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录