Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0a37d464
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看板
提交
0a37d464
编写于
7月 22, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
other: merge 3.0
上级
eb2dcbdc
变更
15
显示空白变更内容
内联
并排
Showing
15 changed file
with
415 addition
and
190 deletion
+415
-190
tests/script/test.sh
tests/script/test.sh
+1
-0
tests/system-test/1-insert/delete_data.py
tests/system-test/1-insert/delete_data.py
+20
-1
tests/system-test/1-insert/update_data.py
tests/system-test/1-insert/update_data.py
+33
-5
tests/system-test/1-insert/update_data_muti_rows.py
tests/system-test/1-insert/update_data_muti_rows.py
+179
-0
tests/system-test/2-query/Now.py
tests/system-test/2-query/Now.py
+8
-8
tests/system-test/2-query/count.py
tests/system-test/2-query/count.py
+4
-6
tests/system-test/2-query/distribute_agg_apercentile.py
tests/system-test/2-query/distribute_agg_apercentile.py
+12
-12
tests/system-test/2-query/distribute_agg_avg.py
tests/system-test/2-query/distribute_agg_avg.py
+22
-22
tests/system-test/2-query/distribute_agg_count.py
tests/system-test/2-query/distribute_agg_count.py
+26
-26
tests/system-test/2-query/distribute_agg_max.py
tests/system-test/2-query/distribute_agg_max.py
+28
-28
tests/system-test/2-query/distribute_agg_min.py
tests/system-test/2-query/distribute_agg_min.py
+28
-28
tests/system-test/2-query/distribute_agg_spread.py
tests/system-test/2-query/distribute_agg_spread.py
+24
-24
tests/system-test/2-query/distribute_agg_sum.py
tests/system-test/2-query/distribute_agg_sum.py
+22
-22
tests/system-test/2-query/irate.py
tests/system-test/2-query/irate.py
+5
-5
tests/system-test/2-query/last.py
tests/system-test/2-query/last.py
+3
-3
未找到文件。
tests/script/test.sh
浏览文件 @
0a37d464
...
...
@@ -84,6 +84,7 @@ echo "SIM_DIR : $SIM_DIR"
echo
"CODE_DIR :
$CODE_DIR
"
echo
"CFG_DIR :
$CFG_DIR
"
rm
-rf
$SIM_DIR
/
*
rm
-rf
$LOG_DIR
rm
-rf
$CFG_DIR
...
...
tests/system-test/1-insert/delete_data.py
浏览文件 @
0a37d464
...
...
@@ -214,6 +214,24 @@ class TDTestCase:
tdSql
.
checkRows
((
row_num
-
i
)
*
tb_num
)
for
j
in
range
(
tb_num
):
self
.
insert_base_data
(
col_type
,
f
'
{
tbname
}
_
{
j
}
'
,
row_num
,
base_data
)
for
i
in
range
(
row_num
):
tdSql
.
execute
(
f
'delete from
{
tbname
}
where ts between
{
self
.
ts
}
and
{
self
.
ts
+
i
}
'
)
tdSql
.
execute
(
f
'flush database
{
dbname
}
'
)
tdSql
.
execute
(
'reset query cache'
)
tdSql
.
query
(
f
'select
{
col_name
}
from
{
tbname
}
'
)
if
tb_type
==
'ntb'
or
tb_type
==
'ctb'
:
tdSql
.
checkRows
(
row_num
-
i
-
1
)
self
.
insert_base_data
(
col_type
,
tbname
,
row_num
,
base_data
)
elif
tb_type
==
'stb'
:
tdSql
.
checkRows
(
tb_num
*
(
row_num
-
i
-
1
))
for
j
in
range
(
tb_num
):
self
.
insert_base_data
(
col_type
,
f
'
{
tbname
}
_
{
j
}
'
,
row_num
,
base_data
)
tdSql
.
execute
(
f
'delete from
{
tbname
}
where ts between
{
self
.
ts
+
i
+
1
}
and
{
self
.
ts
}
'
)
tdSql
.
query
(
f
'select
{
col_name
}
from
{
tbname
}
'
)
if
tb_type
==
'ntb'
or
tb_type
==
'ctb'
:
tdSql
.
checkRows
(
row_num
)
elif
tb_type
==
'stb'
:
tdSql
.
checkRows
(
tb_num
*
row_num
)
def
delete_error
(
self
,
tbname
,
column_name
,
column_type
,
base_data
):
for
error_list
in
[
''
,
f
'ts =
{
self
.
ts
}
and'
,
f
'ts =
{
self
.
ts
}
or'
]:
if
'binary'
in
column_type
.
lower
():
...
...
@@ -222,6 +240,7 @@ class TDTestCase:
tdSql
.
error
(
f
'''delete from
{
tbname
}
where
{
error_list
}
{
column_name
}
="
{
base_data
[
'nchar'
]
}
"'''
)
else
:
tdSql
.
error
(
f
'delete from
{
tbname
}
where
{
error_list
}
{
column_name
}
=
{
base_data
[
column_type
]
}
'
)
def
delete_data_ntb
(
self
):
tdSql
.
execute
(
f
'create database if not exists
{
self
.
dbname
}
'
)
tdSql
.
execute
(
f
'use
{
self
.
dbname
}
'
)
...
...
tests/system-test/1-insert/update_data.py
浏览文件 @
0a37d464
...
...
@@ -13,6 +13,7 @@
import
random
import
string
from
datetime
import
datetime
from
util
import
constant
from
util.log
import
*
from
util.cases
import
*
...
...
@@ -55,7 +56,7 @@ class TDTestCase:
else
:
tdLog
.
exit
(
f
'
{
col_name
}
data check failure'
)
elif
col_type
.
lower
()
==
'timestamp'
:
tdSql
.
checkEqual
(
str
(
tdSql
.
queryResult
[
0
][
0
]),
str
(
datetime
.
datetime
.
fromtimestamp
(
value
/
1000
).
strftime
(
"%Y-%m-%d %H:%M:%S.%f"
)))
tdSql
.
checkEqual
(
str
(
tdSql
.
queryResult
[
0
][
0
]),
str
(
datetime
.
fromtimestamp
(
value
/
1000
).
strftime
(
"%Y-%m-%d %H:%M:%S.%f"
)))
else
:
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
0
][
0
],
value
)
def
update_and_check_data
(
self
,
tbname
,
col_name
,
col_type
,
value
,
dbname
):
...
...
@@ -81,39 +82,63 @@ class TDTestCase:
if
col_type
.
lower
()
==
'double'
:
for
error_value
in
[
tdCom
.
getLongName
(
self
.
str_length
),
True
,
False
,
1.1
*
constant
.
DOUBLE_MIN
,
1.1
*
constant
.
DOUBLE_MAX
]:
tdSql
.
error
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
if
tb_type
==
'ctb'
:
tdSql
.
error
(
f
'insert into
{
stbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
elif
col_type
.
lower
()
==
'float'
:
for
error_value
in
[
tdCom
.
getLongName
(
self
.
str_length
),
True
,
False
,
1.1
*
constant
.
FLOAT_MIN
,
1.1
*
constant
.
FLOAT_MAX
]:
tdSql
.
error
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
if
tb_type
==
'ctb'
:
tdSql
.
error
(
f
'insert into
{
stbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
elif
'binary'
in
col_type
.
lower
()
or
'nchar'
in
col_type
.
lower
():
for
error_value
in
[
tdCom
.
getLongName
(
str_length
)]:
tdSql
.
error
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
}
,"
{
error_value
}
")'
)
if
tb_type
==
'ctb'
:
tdSql
.
error
(
f
'insert into
{
stbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
elif
col_type
.
lower
()
==
'bool'
:
for
error_value
in
[
tdCom
.
getLongName
(
self
.
str_length
)]:
tdSql
.
error
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
if
tb_type
==
'ctb'
:
tdSql
.
error
(
f
'insert into
{
stbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
elif
col_type
.
lower
()
==
'tinyint'
:
for
error_value
in
[
constant
.
TINYINT_MIN
-
1
,
constant
.
TINYINT_MAX
+
1
,
random
.
uniform
(
constant
.
FLOAT_MIN
,
constant
.
FLOAT_MAX
),
tdCom
.
getLongName
(
self
.
str_length
),
True
,
False
]:
tdSql
.
error
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
if
tb_type
==
'ctb'
:
tdSql
.
error
(
f
'insert into
{
stbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
elif
col_type
.
lower
()
==
'smallint'
:
for
error_value
in
[
constant
.
SMALLINT_MIN
-
1
,
constant
.
SMALLINT_MAX
+
1
,
random
.
uniform
(
constant
.
FLOAT_MIN
,
constant
.
FLOAT_MAX
),
tdCom
.
getLongName
(
self
.
str_length
),
True
,
False
]:
tdSql
.
error
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
if
tb_type
==
'ctb'
:
tdSql
.
error
(
f
'insert into
{
stbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
elif
col_type
.
lower
()
==
'int'
:
for
error_value
in
[
constant
.
INT_MIN
-
1
,
constant
.
INT_MAX
+
1
,
random
.
uniform
(
constant
.
FLOAT_MIN
,
constant
.
FLOAT_MAX
),
tdCom
.
getLongName
(
self
.
str_length
),
True
,
False
]:
tdSql
.
error
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
if
tb_type
==
'ctb'
:
tdSql
.
error
(
f
'insert into
{
stbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
elif
col_type
.
lower
()
==
'bigint'
:
for
error_value
in
[
constant
.
BIGINT_MIN
-
1
,
constant
.
BIGINT_MAX
+
1
,
random
.
uniform
(
constant
.
FLOAT_MIN
,
constant
.
FLOAT_MAX
),
tdCom
.
getLongName
(
self
.
str_length
),
True
,
False
]:
tdSql
.
error
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
if
tb_type
==
'ctb'
:
tdSql
.
error
(
f
'insert into
{
stbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
elif
col_type
.
lower
()
==
'tinyint unsigned'
:
for
error_value
in
[
constant
.
TINYINT_UN_MIN
-
1
,
constant
.
TINYINT_UN_MAX
+
1
,
random
.
uniform
(
constant
.
FLOAT_MIN
,
constant
.
FLOAT_MAX
),
tdCom
.
getLongName
(
self
.
str_length
),
True
,
False
]:
tdSql
.
error
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
if
tb_type
==
'ctb'
:
tdSql
.
error
(
f
'insert into
{
stbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
elif
col_type
.
lower
()
==
'smallint unsigned'
:
for
error_value
in
[
constant
.
SMALLINT_UN_MIN
-
1
,
constant
.
SMALLINT_UN_MAX
+
1
,
random
.
uniform
(
constant
.
FLOAT_MIN
,
constant
.
FLOAT_MAX
),
tdCom
.
getLongName
(
self
.
str_length
),
True
,
False
]:
tdSql
.
error
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
if
tb_type
==
'ctb'
:
tdSql
.
error
(
f
'insert into
{
stbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
elif
col_type
.
lower
()
==
'int unsigned'
:
for
error_value
in
[
constant
.
INT_UN_MIN
-
1
,
constant
.
INT_UN_MAX
+
1
,
random
.
uniform
(
constant
.
FLOAT_MIN
,
constant
.
FLOAT_MAX
),
tdCom
.
getLongName
(
self
.
str_length
),
True
,
False
]:
tdSql
.
error
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
if
tb_type
==
'ctb'
:
tdSql
.
error
(
f
'insert into
{
stbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
elif
col_type
.
lower
()
==
'bigint unsigned'
:
for
error_value
in
[
constant
.
BIGINT_UN_MIN
-
1
,
constant
.
BIGINT_UN_MAX
+
1
,
random
.
uniform
(
constant
.
FLOAT_MIN
,
constant
.
FLOAT_MAX
),
tdCom
.
getLongName
(
self
.
str_length
),
True
,
False
]:
tdSql
.
error
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
if
tb_type
==
'ctb'
:
tdSql
.
error
(
f
'insert into
{
stbname
}
values(
{
self
.
ts
}
,
{
error_value
}
)'
)
tdSql
.
execute
(
f
'drop table
{
tbname
}
'
)
if
tb_type
==
'ctb'
:
tdSql
.
execute
(
f
'drop table
{
stbname
}
'
)
...
...
@@ -218,8 +243,11 @@ class TDTestCase:
self
.
error_check
(
self
.
ctbname
,
self
.
column_dict
,
'ctb'
,
self
.
stbname
)
def
run
(
self
):
#!bug TD-17708 and TD-17709
# for i in range(10):
self
.
update_check
()
self
.
update_check_error
()
# i+=1
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/system-test/1-insert/update_data_muti_rows.py
0 → 100644
浏览文件 @
0a37d464
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
random
import
string
from
numpy
import
logspace
from
util
import
constant
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.common
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
self
.
dbname
=
'db_test'
self
.
ntbname
=
'ntb'
self
.
stbname
=
'stb'
self
.
rowNum
=
10
self
.
tbnum
=
5
self
.
ts
=
1537146000000
self
.
str_length
=
20
self
.
column_dict
=
{
'col1'
:
'tinyint'
,
'col2'
:
'smallint'
,
'col3'
:
'int'
,
'col4'
:
'bigint'
,
'col5'
:
'tinyint unsigned'
,
'col6'
:
'smallint unsigned'
,
'col7'
:
'int unsigned'
,
'col8'
:
'bigint unsigned'
,
'col9'
:
'float'
,
'col10'
:
'double'
,
'col11'
:
'bool'
,
'col12'
:
f
'binary(
{
self
.
str_length
}
)'
,
'col13'
:
f
'nchar(
{
self
.
str_length
}
)'
}
self
.
tinyint_val
=
random
.
randint
(
constant
.
TINYINT_MIN
,
constant
.
TINYINT_MAX
)
self
.
smallint_val
=
random
.
randint
(
constant
.
SMALLINT_MIN
,
constant
.
SMALLINT_MAX
)
self
.
int_val
=
random
.
randint
(
constant
.
INT_MIN
,
constant
.
INT_MAX
)
self
.
bigint_val
=
random
.
randint
(
constant
.
BIGINT_MIN
,
constant
.
BIGINT_MAX
)
self
.
untingint_val
=
random
.
randint
(
constant
.
TINYINT_UN_MIN
,
constant
.
TINYINT_UN_MAX
)
self
.
unsmallint_val
=
random
.
randint
(
constant
.
SMALLINT_UN_MIN
,
constant
.
SMALLINT_UN_MAX
)
self
.
unint_val
=
random
.
randint
(
constant
.
INT_UN_MIN
,
constant
.
INT_MAX
)
self
.
unbigint_val
=
random
.
randint
(
constant
.
BIGINT_UN_MIN
,
constant
.
BIGINT_UN_MAX
)
self
.
float_val
=
random
.
uniform
(
constant
.
FLOAT_MIN
,
constant
.
FLOAT_MAX
)
self
.
double_val
=
random
.
uniform
(
constant
.
DOUBLE_MIN
*
(
1E-300
),
constant
.
DOUBLE_MAX
*
(
1E-300
))
self
.
bool_val
=
random
.
randint
(
0
,
2
)
%
2
self
.
binary_val
=
tdCom
.
getLongName
(
random
.
randint
(
0
,
self
.
str_length
))
self
.
nchar_val
=
tdCom
.
getLongName
(
random
.
randint
(
0
,
self
.
str_length
))
self
.
data
=
{
'tinyint'
:
self
.
tinyint_val
,
'smallint'
:
self
.
smallint_val
,
'int'
:
self
.
int_val
,
'bigint'
:
self
.
bigint_val
,
'tinyint unsigned'
:
self
.
untingint_val
,
'smallint unsigned'
:
self
.
unsmallint_val
,
'int unsigned'
:
self
.
unint_val
,
'bigint unsigned'
:
self
.
unbigint_val
,
'bool'
:
self
.
bool_val
,
'float'
:
self
.
float_val
,
'double'
:
self
.
double_val
,
'binary'
:
self
.
binary_val
,
'nchar'
:
self
.
nchar_val
}
def
update_data
(
self
,
dbname
,
tbname
,
tb_num
,
rows
,
values
,
col_type
):
sql
=
f
'insert into '
for
j
in
range
(
tb_num
):
sql
+=
f
'
{
dbname
}
.
{
tbname
}
_
{
j
}
values'
for
i
in
range
(
rows
):
if
'binary'
in
col_type
.
lower
()
or
'nchar'
in
col_type
.
lower
():
sql
+=
f
'(
{
self
.
ts
+
i
}
,"
{
values
}
")'
else
:
sql
+=
f
'(
{
self
.
ts
+
i
}
,
{
values
}
)'
sql
+=
' '
tdSql
.
execute
(
sql
)
def
insert_data
(
self
,
col_type
,
tbname
,
rows
,
data
):
for
i
in
range
(
rows
):
if
col_type
.
lower
()
==
'tinyint'
:
tdSql
.
execute
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,
{
data
[
"tinyint"
]
}
)'
)
elif
col_type
.
lower
()
==
'smallint'
:
tdSql
.
execute
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,
{
data
[
"smallint"
]
}
)'
)
elif
col_type
.
lower
()
==
'int'
:
tdSql
.
execute
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,
{
data
[
"int"
]
}
)'
)
elif
col_type
.
lower
()
==
'bigint'
:
tdSql
.
execute
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,
{
data
[
"bigint"
]
}
)'
)
elif
col_type
.
lower
()
==
'tinyint unsigned'
:
tdSql
.
execute
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,
{
data
[
"tinyint unsigned"
]
}
)'
)
elif
col_type
.
lower
()
==
'smallint unsigned'
:
tdSql
.
execute
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,
{
data
[
"smallint unsigned"
]
}
)'
)
elif
col_type
.
lower
()
==
'int unsigned'
:
tdSql
.
execute
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,
{
data
[
"int unsigned"
]
}
)'
)
elif
col_type
.
lower
()
==
'bigint unsigned'
:
tdSql
.
execute
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,
{
data
[
"bigint unsigned"
]
}
)'
)
elif
col_type
.
lower
()
==
'bool'
:
tdSql
.
execute
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,
{
data
[
"bool"
]
}
)'
)
elif
col_type
.
lower
()
==
'float'
:
tdSql
.
execute
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,
{
data
[
"float"
]
}
)'
)
elif
col_type
.
lower
()
==
'double'
:
tdSql
.
execute
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,
{
data
[
"double"
]
}
)'
)
elif
'binary'
in
col_type
.
lower
():
tdSql
.
execute
(
f
'''insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,"
{
data
[
'binary'
]
}
")'''
)
elif
'nchar'
in
col_type
.
lower
():
tdSql
.
execute
(
f
'''insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,"
{
data
[
'nchar'
]
}
")'''
)
def
data_check
(
self
,
dbname
,
tbname
,
tbnum
,
rownum
,
data
,
col_name
,
col_type
):
if
'binary'
in
col_type
.
lower
():
self
.
update_data
(
dbname
,
f
'
{
tbname
}
'
,
tbnum
,
rownum
,
data
[
'binary'
],
col_type
)
elif
'nchar'
in
col_type
.
lower
():
self
.
update_data
(
dbname
,
f
'
{
tbname
}
'
,
tbnum
,
rownum
,
data
[
'nchar'
],
col_type
)
else
:
self
.
update_data
(
dbname
,
f
'
{
tbname
}
'
,
tbnum
,
rownum
,
data
[
col_type
],
col_type
)
tdSql
.
execute
(
f
'flush database
{
dbname
}
'
)
tdSql
.
execute
(
'reset query cache'
)
for
i
in
range
(
self
.
tbnum
):
tdSql
.
query
(
f
'select
{
col_name
}
from
{
dbname
}
.
{
tbname
}
_
{
i
}
'
)
for
j
in
range
(
rownum
):
if
col_type
.
lower
()
==
'float'
or
col_type
.
lower
()
==
'double'
:
if
abs
(
tdSql
.
queryResult
[
j
][
0
]
-
data
[
col_type
])
/
data
[
col_type
]
<=
0.0001
:
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
j
][
0
],
tdSql
.
queryResult
[
j
][
0
])
elif
'binary'
in
col_type
.
lower
():
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
j
][
0
],
data
[
'binary'
])
elif
'nchar'
in
col_type
.
lower
():
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
j
][
0
],
data
[
'nchar'
])
else
:
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
j
][
0
],
data
[
col_type
])
def
update_data_ntb
(
self
):
tdSql
.
execute
(
f
'drop database if exists
{
self
.
dbname
}
'
)
tdSql
.
execute
(
f
'create database
{
self
.
dbname
}
'
)
tdSql
.
execute
(
f
'use
{
self
.
dbname
}
'
)
for
col_name
,
col_type
in
self
.
column_dict
.
items
():
for
i
in
range
(
self
.
tbnum
):
tdSql
.
execute
(
f
'create table
{
self
.
dbname
}
.
{
self
.
ntbname
}
_
{
i
}
(ts timestamp,
{
col_name
}
{
col_type
}
)'
)
for
j
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
f
'insert into
{
self
.
dbname
}
.
{
self
.
ntbname
}
_
{
i
}
values(
{
self
.
ts
+
j
}
,null)'
)
tdSql
.
execute
(
f
'flush database
{
self
.
dbname
}
'
)
tdSql
.
execute
(
'reset query cache'
)
self
.
data_check
(
self
.
dbname
,
self
.
ntbname
,
self
.
tbnum
,
self
.
rowNum
,
self
.
data
,
col_name
,
col_type
)
for
i
in
range
(
self
.
tbnum
):
tdSql
.
execute
(
f
'drop table
{
self
.
ntbname
}
_
{
i
}
'
)
def
update_data_ctb
(
self
):
tdSql
.
execute
(
f
'drop database if exists
{
self
.
dbname
}
'
)
tdSql
.
execute
(
f
'create database
{
self
.
dbname
}
'
)
tdSql
.
execute
(
f
'use
{
self
.
dbname
}
'
)
for
col_name
,
col_type
in
self
.
column_dict
.
items
():
tdSql
.
execute
(
f
'create table
{
self
.
dbname
}
.
{
self
.
stbname
}
(ts timestamp,
{
col_name
}
{
col_type
}
) tags(t0 int)'
)
for
i
in
range
(
self
.
tbnum
):
tdSql
.
execute
(
f
'create table
{
self
.
dbname
}
.
{
self
.
stbname
}
_
{
i
}
using
{
self
.
dbname
}
.
{
self
.
stbname
}
tags(1)'
)
for
j
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
f
'insert into
{
self
.
dbname
}
.
{
self
.
stbname
}
_
{
i
}
values(
{
self
.
ts
+
j
}
,null)'
)
tdSql
.
execute
(
f
'flush database
{
self
.
dbname
}
'
)
tdSql
.
execute
(
'reset query cache'
)
self
.
data_check
(
self
.
dbname
,
self
.
stbname
,
self
.
tbnum
,
self
.
rowNum
,
self
.
data
,
col_name
,
col_type
)
tdSql
.
execute
(
f
'drop table
{
self
.
stbname
}
'
)
def
run
(
self
):
self
.
update_data_ntb
()
self
.
update_data_ctb
()
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
\ No newline at end of file
tests/system-test/2-query/Now.py
浏览文件 @
0a37d464
tests/system-test/2-query/count.py
浏览文件 @
0a37d464
...
...
@@ -94,17 +94,15 @@ class TDTestCase:
tdSql
.
execute
(
self
.
setsql
.
set_create_stable_sql
(
self
.
stbname
,
self
.
column_dict
,
self
.
tag_dict
))
for
i
in
range
(
self
.
tbnum
):
tdSql
.
execute
(
f
'create table
{
self
.
stbname
}
_
{
i
}
using
{
self
.
stbname
}
tags(
{
self
.
tag_values
[
i
]
}
)'
)
#!TODO
# tdSql.query(f'SELECT count(*) from (select distinct tbname from {self.stbname})')
# tdSql.checkEqual(tdSql.queryResult[0][0],self.tbnum)
tdSql
.
query
(
f
'SELECT count(*) from (select distinct tbname from
{
self
.
stbname
}
)'
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
0
][
0
],
self
.
tbnum
)
tdSql
.
query
(
f
'select count(tbname) from
{
self
.
stbname
}
'
)
tdSql
.
checkRows
(
0
)
tdSql
.
execute
(
'flush database db'
)
tdSql
.
query
(
f
'select count(tbname) from
{
self
.
stbname
}
'
)
tdSql
.
checkRows
(
0
)
#!TODO
# tdSql.query(f'SELECT count(*) from (select distinct tbname from {self.stbname})')
# tdSql.checkEqual(tdSql.queryResult[0][0],self.tbnum)
tdSql
.
query
(
f
'SELECT count(*) from (select distinct tbname from
{
self
.
stbname
}
)'
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
0
][
0
],
self
.
tbnum
)
for
i
in
range
(
self
.
tbnum
):
self
.
insert_data
(
self
.
column_dict
,
f
'
{
self
.
stbname
}
_
{
i
}
'
,
self
.
rowNum
)
self
.
count_query_stb
(
self
.
column_dict
,
self
.
tag_dict
,
self
.
stbname
,
self
.
tbnum
,
self
.
rowNum
)
...
...
tests/system-test/2-query/distribute_agg_apercentile.py
浏览文件 @
0a37d464
tests/system-test/2-query/distribute_agg_avg.py
浏览文件 @
0a37d464
tests/system-test/2-query/distribute_agg_count.py
浏览文件 @
0a37d464
tests/system-test/2-query/distribute_agg_max.py
浏览文件 @
0a37d464
tests/system-test/2-query/distribute_agg_min.py
浏览文件 @
0a37d464
tests/system-test/2-query/distribute_agg_spread.py
浏览文件 @
0a37d464
tests/system-test/2-query/distribute_agg_sum.py
浏览文件 @
0a37d464
tests/system-test/2-query/irate.py
浏览文件 @
0a37d464
tests/system-test/2-query/last.py
浏览文件 @
0a37d464
...
...
@@ -222,9 +222,9 @@ class TDTestCase:
if
vgroups_num
>=
2
:
tdLog
.
info
(
f
'This scene with
{
vgroups_num
}
vgroups is ok!'
)
continue
else
:
tdLog
.
exit
(
'This scene does not meet the requirements with {vgroups_num} vgroup!
\n
'
)
#
else:
#
tdLog.exit(
# f
'This scene does not meet the requirements with {vgroups_num} vgroup!\n')
for
i
in
range
(
self
.
tbnum
):
for
j
in
range
(
self
.
rowNum
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录