Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f2807216
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看板
未验证
提交
f2807216
编写于
7月 29, 2022
作者:
G
Ganlin Zhao
提交者:
GitHub
7月 29, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #15541 from taosdata/fix/TD-17009
fix(query): fix apercentile with interval crash issue
上级
75d7493c
93d27a87
变更
15
展开全部
隐藏空白更改
内联
并排
Showing
15 changed file
with
222 addition
and
222 deletion
+222
-222
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+3
-3
tests/system-test/1-insert/delete_data.py
tests/system-test/1-insert/delete_data.py
+9
-9
tests/system-test/1-insert/influxdb_line_taosc_insert.py
tests/system-test/1-insert/influxdb_line_taosc_insert.py
+28
-28
tests/system-test/1-insert/insertWithMoreVgroup.py
tests/system-test/1-insert/insertWithMoreVgroup.py
+34
-34
tests/system-test/1-insert/insert_drop.py
tests/system-test/1-insert/insert_drop.py
+1
-1
tests/system-test/1-insert/mutipythonnodebugtaosd.py
tests/system-test/1-insert/mutipythonnodebugtaosd.py
+15
-15
tests/system-test/1-insert/opentsdb_json_taosc_insert.py
tests/system-test/1-insert/opentsdb_json_taosc_insert.py
+56
-56
tests/system-test/1-insert/opentsdb_telnet_line_taosc_insert.py
...system-test/1-insert/opentsdb_telnet_line_taosc_insert.py
+33
-33
tests/system-test/1-insert/table_comment.py
tests/system-test/1-insert/table_comment.py
+4
-4
tests/system-test/1-insert/table_param_ttl.py
tests/system-test/1-insert/table_param_ttl.py
+1
-1
tests/system-test/1-insert/test_stmt_muti_insert_query.py
tests/system-test/1-insert/test_stmt_muti_insert_query.py
+8
-8
tests/system-test/1-insert/test_stmt_set_tbname_tag.py
tests/system-test/1-insert/test_stmt_set_tbname_tag.py
+12
-12
tests/system-test/1-insert/update_data.py
tests/system-test/1-insert/update_data.py
+9
-9
tests/system-test/1-insert/update_data_muti_rows.py
tests/system-test/1-insert/update_data_muti_rows.py
+7
-7
tests/system-test/2-query/distribute_agg_apercentile.py
tests/system-test/2-query/distribute_agg_apercentile.py
+2
-2
未找到文件。
source/libs/function/src/builtins.c
浏览文件 @
f2807216
...
...
@@ -2068,7 +2068,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"apercentile"
,
.
type
=
FUNCTION_TYPE_APERCENTILE
,
.
classification
=
FUNC_MGT_AGG_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_TIMELINE_FUNC
,
.
translateFunc
=
translateApercentile
,
.
getEnvFunc
=
getApercentileFuncEnv
,
.
initFunc
=
apercentileFunctionSetup
,
...
...
@@ -2083,7 +2083,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
},
{
.
name
=
"_apercentile_partial"
,
.
type
=
FUNCTION_TYPE_APERCENTILE_PARTIAL
,
.
type
=
FUNCTION_TYPE_APERCENTILE_PARTIAL
|
FUNC_MGT_TIMELINE_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
,
.
translateFunc
=
translateApercentilePartial
,
.
getEnvFunc
=
getApercentileFuncEnv
,
...
...
@@ -2096,7 +2096,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"_apercentile_merge"
,
.
type
=
FUNCTION_TYPE_APERCENTILE_MERGE
,
.
classification
=
FUNC_MGT_AGG_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_TIMELINE_FUNC
,
.
translateFunc
=
translateApercentileMerge
,
.
getEnvFunc
=
getApercentileFuncEnv
,
.
initFunc
=
apercentileFunctionSetup
,
...
...
tests/system-test/1-insert/delete_data.py
浏览文件 @
f2807216
...
...
@@ -50,9 +50,9 @@ class TDTestCase:
'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
)
...
...
@@ -100,15 +100,15 @@ class TDTestCase:
elif
col_type
.
lower
()
==
'bigint unsigned'
:
tdSql
.
execute
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,
{
base_data
[
"bigint unsigned"
]
}
)'
)
elif
col_type
.
lower
()
==
'bool'
:
tdSql
.
execute
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,
{
base_data
[
"bool"
]
}
)'
)
tdSql
.
execute
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,
{
base_data
[
"bool"
]
}
)'
)
elif
col_type
.
lower
()
==
'float'
:
tdSql
.
execute
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,
{
base_data
[
"float"
]
}
)'
)
tdSql
.
execute
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,
{
base_data
[
"float"
]
}
)'
)
elif
col_type
.
lower
()
==
'double'
:
tdSql
.
execute
(
f
'insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,
{
base_data
[
"double"
]
}
)'
)
elif
'binary'
in
col_type
.
lower
():
tdSql
.
execute
(
f
'''insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,"
{
base_data
[
'binary'
]
}
")'''
)
elif
'nchar'
in
col_type
.
lower
():
tdSql
.
execute
(
f
'''insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,"
{
base_data
[
'nchar'
]
}
")'''
)
tdSql
.
execute
(
f
'''insert into
{
tbname
}
values(
{
self
.
ts
+
i
}
,"
{
base_data
[
'nchar'
]
}
")'''
)
def
delete_all_data
(
self
,
tbname
,
col_type
,
row_num
,
base_data
,
dbname
,
tb_type
,
tb_num
=
1
):
tdSql
.
execute
(
f
'delete from
{
tbname
}
'
)
tdSql
.
execute
(
f
'flush database
{
dbname
}
'
)
...
...
@@ -164,7 +164,7 @@ class TDTestCase:
elif
'nchar'
in
column_type
.
lower
():
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
0
][
0
],
base_data
[
'nchar'
])
else
:
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
0
][
0
],
base_data
[
column_type
])
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
0
][
0
],
base_data
[
column_type
])
def
delete_rows
(
self
,
dbname
,
tbname
,
col_name
,
col_type
,
base_data
,
row_num
,
tb_type
,
tb_num
=
1
):
for
i
in
range
(
row_num
):
tdSql
.
execute
(
f
'delete from
{
tbname
}
where ts>
{
self
.
ts
+
i
}
'
)
...
...
@@ -189,7 +189,7 @@ class TDTestCase:
elif
tb_type
==
'stb'
:
tdSql
.
checkRows
(
i
*
tb_num
)
for
j
in
range
(
tb_num
):
self
.
insert_base_data
(
col_type
,
f
'
{
tbname
}
_
{
j
}
'
,
row_num
,
base_data
)
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<=
{
self
.
ts
+
i
}
'
)
tdSql
.
execute
(
f
'flush database
{
dbname
}
'
)
...
...
@@ -240,7 +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
}
'
)
...
...
@@ -295,4 +295,4 @@ class TDTestCase:
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
\ No newline at end of file
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/system-test/1-insert/influxdb_line_taosc_insert.py
浏览文件 @
f2807216
...
...
@@ -26,13 +26,13 @@ from util.common import tdCom
import
platform
import
io
if
platform
.
system
().
lower
()
==
'windows'
:
sys
.
stdout
=
io
.
TextIOWrapper
(
sys
.
stdout
.
buffer
,
encoding
=
'utf8'
)
sys
.
stdout
=
io
.
TextIOWrapper
(
sys
.
stdout
.
buffer
,
encoding
=
'utf8'
)
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
_conn
=
conn
self
.
_conn
=
conn
def
createDb
(
self
,
name
=
"test"
,
db_update_tag
=
0
):
if
db_update_tag
==
0
:
...
...
@@ -67,7 +67,7 @@ class TDTestCase:
td_ts
=
time
.
strftime
(
"%Y-%m-%d %H:%M:%S.{}"
.
format
(
ulsec
),
time
.
localtime
(
ts
))
return
td_ts
#return repr(datetime.datetime.strptime(td_ts, "%Y-%m-%d %H:%M:%S.%f"))
def
dateToTs
(
self
,
datetime_input
):
return
int
(
time
.
mktime
(
time
.
strptime
(
datetime_input
,
"%Y-%m-%d %H:%M:%S.%f"
)))
...
...
@@ -274,7 +274,7 @@ class TDTestCase:
input_sql
=
self
.
gen_influxdb_line
(
stb_name
,
tb_name
,
id
,
t0
,
t1
,
t2
,
t3
,
t4
,
t5
,
t6
,
t7
,
t8
,
c0
,
c1
,
c2
,
c3
,
c4
,
c5
,
c6
,
c7
,
c8
,
c9
,
ts
,
id_noexist_tag
,
id_change_tag
,
id_double_tag
,
ct_add_tag
,
ct_am_tag
,
ct_ma_tag
,
ct_min_tag
,
c_multi_tag
,
t_multi_tag
,
c_blank_tag
,
t_blank_tag
,
chinese_tag
)
return
input_sql
,
stb_name
def
genMulTagColStr
(
self
,
gen_type
,
count
):
"""
gen_type must be "tag"/"col"
...
...
@@ -370,10 +370,10 @@ class TDTestCase:
for
t_type
in
full_type_list
:
input_sql
,
stb_name
=
self
.
genFullTypeSql
(
c0
=
t_type
,
t0
=
t_type
)
self
.
resCmp
(
input_sql
,
stb_name
)
def
symbolsCheckCase
(
self
):
"""
check symbols = `~!@#$%^&*()_-+={[}]\|:;'
\"
,<.>/?
check symbols = `~!@#$%^&*()_-+={[}]\|:;'
\"
,<.>/?
"""
'''
please test :
...
...
@@ -395,7 +395,7 @@ class TDTestCase:
for
ts
in
ts_list
:
input_sql
,
stb_name
=
self
.
genFullTypeSql
(
ts
=
ts
)
self
.
resCmp
(
input_sql
,
stb_name
,
ts
=
ts
)
def
idSeqCheckCase
(
self
):
"""
check id.index in tags
...
...
@@ -404,7 +404,7 @@ class TDTestCase:
tdCom
.
cleanTb
()
input_sql
,
stb_name
=
self
.
genFullTypeSql
(
id_change_tag
=
True
)
self
.
resCmp
(
input_sql
,
stb_name
)
def
idUpperCheckCase
(
self
):
"""
check id param
...
...
@@ -444,7 +444,7 @@ class TDTestCase:
self
.
_conn
.
schemaless_insert
([
input_sql
],
TDSmlProtocolType
.
LINE
.
value
,
TDSmlTimestampType
.
NANO_SECOND
.
value
)
except
SchemalessError
as
err
:
tdSql
.
checkNotEqual
(
err
.
errno
,
0
)
def
idIllegalNameCheckCase
(
self
):
"""
test illegal id name
...
...
@@ -490,7 +490,7 @@ class TDTestCase:
self
.
_conn
.
schemaless_insert
([
input_sql
],
TDSmlProtocolType
.
LINE
.
value
,
TDSmlTimestampType
.
NANO_SECOND
.
value
)
except
SchemalessError
as
err
:
tdSql
.
checkNotEqual
(
err
.
errno
,
0
)
def
illegalTsCheckCase
(
self
):
"""
check ts format like 16260068336390us19
...
...
@@ -575,11 +575,11 @@ class TDTestCase:
except
SchemalessError
as
err
:
tdSql
.
checkNotEqual
(
err
.
errno
,
0
)
# binary
# binary
stb_name
=
tdCom
.
getLongName
(
7
,
"letters"
)
input_sql
=
f
'
{
stb_name
}
,t0=t,t1="
{
tdCom
.
getLongName
(
16374
,
"letters"
)
}
" c0=f 1626006833639000000'
self
.
_conn
.
schemaless_insert
([
input_sql
],
TDSmlProtocolType
.
LINE
.
value
,
TDSmlTimestampType
.
NANO_SECOND
.
value
)
input_sql
=
f
'
{
stb_name
}
,t0=t,t1="
{
tdCom
.
getLongName
(
16375
,
"letters"
)
}
" c0=f 1626006833639000000'
try
:
self
.
_conn
.
schemaless_insert
([
input_sql
],
TDSmlProtocolType
.
LINE
.
value
,
TDSmlTimestampType
.
NANO_SECOND
.
value
)
...
...
@@ -647,7 +647,7 @@ class TDTestCase:
except
SchemalessError
as
err
:
tdSql
.
checkNotEqual
(
err
.
errno
,
0
)
# f32
# f32
for
c5
in
[
f
"
{
-
3.4028234663852885981170418348451692544
*
(
10
**
38
)
}
f32"
,
f
"
{
3.4028234663852885981170418348451692544
*
(
10
**
38
)
}
f32"
]:
input_sql
,
stb_name
=
self
.
genFullTypeSql
(
c5
=
c5
)
self
.
resCmp
(
input_sql
,
stb_name
)
...
...
@@ -671,11 +671,11 @@ class TDTestCase:
except
SchemalessError
as
err
:
tdSql
.
checkNotEqual
(
err
.
errno
,
0
)
# # # binary
# # # binary
# stb_name = tdCom.getLongName(7, "letters")
# input_sql = f'{stb_name},t0=t c0=f,c1="{tdCom.getLongName(16374, "letters")}" 1626006833639000000'
# self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
# input_sql = f'{stb_name},t0=t c0=f,c1="{tdCom.getLongName(16375, "letters")}" 1626006833639000000'
# try:
# self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
...
...
@@ -715,13 +715,13 @@ class TDTestCase:
# i8 i16 i32 i64 f32 f64
for
input_sql
in
[
self
.
genFullTypeSql
(
t1
=
"1s2i8"
)[
0
],
self
.
genFullTypeSql
(
t1
=
"1s2i8"
)[
0
],
self
.
genFullTypeSql
(
t2
=
"1s2i16"
)[
0
],
self
.
genFullTypeSql
(
t3
=
"1s2i32"
)[
0
],
self
.
genFullTypeSql
(
t4
=
"1s2i64"
)[
0
],
self
.
genFullTypeSql
(
t5
=
"11.1s45f32"
)[
0
],
self
.
genFullTypeSql
(
t6
=
"11.1s45f64"
)[
0
],
self
.
genFullTypeSql
(
c1
=
"1s2i8"
)[
0
],
self
.
genFullTypeSql
(
t6
=
"11.1s45f64"
)[
0
],
self
.
genFullTypeSql
(
c1
=
"1s2i8"
)[
0
],
self
.
genFullTypeSql
(
c2
=
"1s2i16"
)[
0
],
self
.
genFullTypeSql
(
c3
=
"1s2i32"
)[
0
],
self
.
genFullTypeSql
(
c4
=
"1s2i64"
)[
0
],
...
...
@@ -746,14 +746,14 @@ class TDTestCase:
except
SchemalessError
as
err
:
tdSql
.
checkNotEqual
(
err
.
errno
,
0
)
# check accepted binary and nchar symbols
# check accepted binary and nchar symbols
# # * ~!@#$¥%^&*()-+={}|[]、「」:;
for
symbol
in
list
(
'~!@#$¥%^&*()-+={}|[]、「」:;'
):
input_sql1
=
f
'
{
stb_name
}
,t0=t c0=f,c1="abc
{
symbol
}
aaa" 1626006833639000000'
input_sql2
=
f
'
{
stb_name
}
,t0=t,t1="abc
{
symbol
}
aaa" c0=f 1626006833639000000'
self
.
_conn
.
schemaless_insert
([
input_sql1
],
TDSmlProtocolType
.
LINE
.
value
,
TDSmlTimestampType
.
NANO_SECOND
.
value
)
# self._conn.schemaless_insert([input_sql2], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
def
duplicateIdTagColInsertCheckCase
(
self
):
"""
check duplicate Id Tag Col
...
...
@@ -810,7 +810,7 @@ class TDTestCase:
self
.
resCmp
(
input_sql
,
stb_name
)
self
.
_conn
.
schemaless_insert
([
input_sql
],
TDSmlProtocolType
.
LINE
.
value
,
TDSmlTimestampType
.
NANO_SECOND
.
value
)
self
.
resCmp
(
input_sql
,
stb_name
)
@
tdCom
.
smlPass
def
tagColBinaryNcharLengthCheckCase
(
self
):
"""
...
...
@@ -829,7 +829,7 @@ class TDTestCase:
check column and tag count add, stb and tb duplicate
* tag: alter table ...
* col: when update==0 and ts is same, unchange
* so this case tag&&value will be added,
* so this case tag&&value will be added,
* col is added without value when update==0
* col is added with value when update==1
"""
...
...
@@ -897,7 +897,7 @@ class TDTestCase:
# * every binary and nchar must be length+2, so here is two tag, max length could not larger than 16384-2*2
input_sql
=
f
'
{
stb_name
}
,t0=t,t1="
{
tdCom
.
getLongName
(
16374
,
"letters"
)
}
",t2="
{
tdCom
.
getLongName
(
5
,
"letters"
)
}
" c0=f 1626006833639000000'
self
.
_conn
.
schemaless_insert
([
input_sql
],
TDSmlProtocolType
.
LINE
.
value
,
TDSmlTimestampType
.
NANO_SECOND
.
value
)
tdSql
.
query
(
f
"select * from
{
stb_name
}
"
)
tdSql
.
checkRows
(
2
)
input_sql
=
f
'
{
stb_name
}
,t0=t,t1="
{
tdCom
.
getLongName
(
16374
,
"letters"
)
}
",t2="
{
tdCom
.
getLongName
(
6
,
"letters"
)
}
" c0=f 1626006833639000000'
...
...
@@ -922,7 +922,7 @@ class TDTestCase:
tdSql
.
checkNotEqual
(
err
.
errno
,
0
)
tdSql
.
query
(
f
"select * from
{
stb_name
}
"
)
tdSql
.
checkRows
(
3
)
# * tag nchar max is 16374/4, col+ts nchar max 49151
def
tagColNcharMaxLengthCheckCase
(
self
):
"""
...
...
@@ -977,7 +977,7 @@ class TDTestCase:
"st123456,t1=4i64,t3=
\"
t4
\"
,t2=5f64,t4=5f64 c1=3i64,c3=L
\"
passitagin_stf
\"
,c2=false,c5=5f64,c6=7u64 1626006933641000000"
]
self
.
_conn
.
schemaless_insert
(
lines
,
TDSmlProtocolType
.
LINE
.
value
,
TDSmlTimestampType
.
NANO_SECOND
.
value
)
def
multiInsertCheckCase
(
self
,
count
):
"""
test multi insert
...
...
@@ -1073,7 +1073,7 @@ class TDTestCase:
self
.
multiThreadRun
(
self
.
genMultiThreadSeq
(
input_sql
))
tdSql
.
query
(
f
"show tables;"
)
tdSql
.
checkRows
(
5
)
def
sStbStbDdataInsertMultiThreadCheckCase
(
self
):
"""
thread input same stb tb, different data, result keep first data
...
...
@@ -1107,7 +1107,7 @@ class TDTestCase:
tdSql
.
checkEqual
(
tb_name
,
expected_tb_name
)
tdSql
.
query
(
f
"select * from
{
stb_name
}
;"
)
tdSql
.
checkRows
(
1
)
def
sStbStbDdataMtcInsertMultiThreadCheckCase
(
self
):
"""
thread input same stb tb, different data, minus columes and tags, result keep first data
...
...
@@ -1217,7 +1217,7 @@ class TDTestCase:
tdSql
.
checkRows
(
6
)
for
c
in
[
"c7"
,
"c8"
,
"c9"
]:
tdSql
.
query
(
f
"select * from
{
stb_name
}
where
{
c
}
is NULL"
)
tdSql
.
checkRows
(
5
)
tdSql
.
checkRows
(
5
)
for
t
in
[
"t10"
,
"t11"
]:
tdSql
.
query
(
f
"select * from
{
stb_name
}
where
{
t
}
is not NULL;"
)
tdSql
.
checkRows
(
6
)
...
...
tests/system-test/1-insert/insertWithMoreVgroup.py
浏览文件 @
f2807216
...
...
@@ -43,7 +43,7 @@ class TDTestCase:
case1: limit offset base function test
case2: offset return valid
'''
return
return
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
...
...
@@ -69,7 +69,7 @@ class TDTestCase:
# self.create_tables();
self
.
ts
=
1500000000000
# stop
# stop
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
@@ -80,7 +80,7 @@ class TDTestCase:
def
newcur
(
self
,
host
,
cfg
):
user
=
"root"
password
=
"taosdata"
port
=
6030
port
=
6030
con
=
taos
.
connect
(
host
=
host
,
user
=
user
,
password
=
password
,
config
=
cfg
,
port
=
port
)
cur
=
con
.
cursor
()
print
(
cur
)
...
...
@@ -90,7 +90,7 @@ class TDTestCase:
def
create_tables
(
self
,
host
,
dbname
,
stbname
,
count
):
buildPath
=
self
.
getBuildPath
()
config
=
buildPath
+
"../sim/dnode1/cfg/"
tsql
=
self
.
newcur
(
host
,
config
)
tsql
.
execute
(
"use %s"
%
dbname
)
...
...
@@ -109,7 +109,7 @@ class TDTestCase:
tsql
.
execute
(
sql
)
sql
=
pre_create
# print(time.time())
# end sql
# end sql
if
sql
!=
pre_create
:
# print(sql)
tsql
.
execute
(
sql
)
...
...
@@ -122,7 +122,7 @@ class TDTestCase:
def
mutiThread_create_tables
(
self
,
host
,
dbname
,
stbname
,
vgroups
,
threadNumbers
,
childcount
):
buildPath
=
self
.
getBuildPath
()
config
=
buildPath
+
"../sim/dnode1/cfg/"
tsql
=
self
.
newcur
(
host
,
config
)
tdLog
.
debug
(
"create database %s"
%
dbname
)
tsql
.
execute
(
"drop database if exists %s"
%
dbname
)
...
...
@@ -132,7 +132,7 @@ class TDTestCase:
threads
=
[]
for
i
in
range
(
threadNumbers
):
tsql
.
execute
(
"create stable %s%d(ts timestamp, c1 int, c2 binary(10)) tags(t1 int)"
%
(
stbname
,
i
))
threads
.
append
(
thd
.
Thread
(
target
=
self
.
create_tables
,
args
=
(
host
,
dbname
,
stbname
+
"%d"
%
i
,
count
,)))
threads
.
append
(
thd
.
Thread
(
target
=
self
.
create_tables
,
args
=
(
host
,
dbname
,
stbname
+
"%d"
%
i
,
count
,)))
start_time
=
time
.
time
()
for
tr
in
threads
:
tr
.
start
()
...
...
@@ -142,7 +142,7 @@ class TDTestCase:
spendTime
=
end_time
-
start_time
speedCreate
=
threadNumbers
*
count
/
spendTime
tdLog
.
debug
(
"spent %.2fs to create %d stable and %d table, create speed is %.2f table/s... [OK]"
%
(
spendTime
,
threadNumbers
,
threadNumbers
*
count
,
speedCreate
))
return
# def create_tables(self,host,dbname,stbname,vgroups,tcountStart,tcountStop):
...
...
@@ -169,7 +169,7 @@ class TDTestCase:
# print(sql)
tsql
.
execute
(
sql
)
sql
=
"insert into %s_%d values "
%
(
stbname
,
i
)
# end sql
# end sql
if
sql
!=
pre_insert
:
# print(sql)
print
(
len
(
sql
))
...
...
@@ -184,7 +184,7 @@ class TDTestCase:
def
mutiThread_insert_data
(
self
,
host
,
dbname
,
stbname
,
threadNumbers
,
chilCount
,
ts_start
,
childrowcount
):
buildPath
=
self
.
getBuildPath
()
config
=
buildPath
+
"../sim/dnode1/cfg/"
tsql
=
self
.
newcur
(
host
,
config
)
tdLog
.
debug
(
"ready to inser data"
)
...
...
@@ -193,7 +193,7 @@ class TDTestCase:
threads
=
[]
for
i
in
range
(
threadNumbers
):
# tsql.execute("create stable %s%d(ts timestamp, c1 int, c2 binary(10)) tags(t1 int)"%(stbname,i))
threads
.
append
(
thd
.
Thread
(
target
=
self
.
insert_data
,
args
=
(
host
,
dbname
,
stbname
+
"%d"
%
i
,
chilCount
,
ts_start
,
childrowcount
,)))
threads
.
append
(
thd
.
Thread
(
target
=
self
.
insert_data
,
args
=
(
host
,
dbname
,
stbname
+
"%d"
%
i
,
chilCount
,
ts_start
,
childrowcount
,)))
start_time
=
time
.
time
()
for
tr
in
threads
:
tr
.
start
()
...
...
@@ -224,10 +224,10 @@ class TDTestCase:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
taosBenchbin
=
buildPath
+
"/build/bin/taosBenchmark"
os
.
system
(
"%s -f %s -y "
%
(
taosBenchbin
,
jsonFile
))
return
def
taosBenchCreate
(
self
,
host
,
dropdb
,
dbname
,
stbname
,
vgroups
,
processNumbers
,
count
):
# count=50000
buildPath
=
self
.
getBuildPath
()
config
=
buildPath
+
"../sim/dnode1/cfg/"
...
...
@@ -241,7 +241,7 @@ class TDTestCase:
# tsql.getResult("show databases")
# print(tdSql.queryResult)
tsql
.
execute
(
"use %s"
%
dbname
)
threads
=
[]
for
i
in
range
(
processNumbers
):
jsonfile
=
"1-insert/Vgroups%d%d.json"
%
(
vgroups
,
i
)
...
...
@@ -252,7 +252,7 @@ class TDTestCase:
os
.
system
(
"sed -i 's/
\"
childtable_count
\"
: 10000,/
\"
childtable_count
\"
: %d,/g' %s "
%
(
count
,
jsonfile
))
os
.
system
(
"sed -i 's/
\"
name
\"
:
\"
stb1
\"
,/
\"
name
\"
:
\"
%s%d
\"
,/g' %s "
%
(
stbname
,
i
,
jsonfile
))
os
.
system
(
"sed -i 's/
\"
childtable_prefix
\"
:
\"
stb1_
\"
,/
\"
childtable_prefix
\"
:
\"
%s%d_
\"
,/g' %s "
%
(
stbname
,
i
,
jsonfile
))
threads
.
append
(
mp
.
Process
(
target
=
self
.
taosBench
,
args
=
(
"%s"
%
jsonfile
,)))
threads
.
append
(
mp
.
Process
(
target
=
self
.
taosBench
,
args
=
(
"%s"
%
jsonfile
,)))
start_time
=
time
.
time
()
for
tr
in
threads
:
tr
.
start
()
...
...
@@ -274,10 +274,10 @@ class TDTestCase:
for
i
in
range
(
stableCount
):
tdSql
.
query
(
"select count(*) from %s%d"
%
(
stbname
,
i
))
tdSql
.
checkData
(
0
,
0
,
rowsPerSTable
)
return
# test case1 base
return
# test case1 base
def
test_case1
(
self
):
#stableCount=threadNumbersCtb
parameterDict
=
{
'vgroups'
:
1
,
\
...
...
@@ -290,22 +290,22 @@ class TDTestCase:
'stbname'
:
'stb'
,
\
'host'
:
'localhost'
,
\
'startTs'
:
1640966400000
}
# 2022-01-01 00:00:00.000
tdLog
.
debug
(
"-----create database and muti-thread create tables test------- "
)
#host,dbname,stbname,vgroups,threadNumbers,tcountStart,tcountStop
#host, dbname, stbname, threadNumbers, chilCount, ts_start, childrowcount
self
.
mutiThread_create_tables
(
host
=
parameterDict
[
'host'
],
dbname
=
parameterDict
[
'dbname'
],
stbname
=
parameterDict
[
'stbname'
],
vgroups
=
parameterDict
[
'vgroups'
],
threadNumbers
=
parameterDict
[
'threadNumbersCtb'
],
stbname
=
parameterDict
[
'stbname'
],
vgroups
=
parameterDict
[
'vgroups'
],
threadNumbers
=
parameterDict
[
'threadNumbersCtb'
],
childcount
=
parameterDict
[
'tablesPerStb'
])
self
.
mutiThread_insert_data
(
host
=
parameterDict
[
'host'
],
dbname
=
parameterDict
[
'dbname'
],
stbname
=
parameterDict
[
'stbname'
],
stbname
=
parameterDict
[
'stbname'
],
threadNumbers
=
parameterDict
[
'threadNumbersIda'
],
chilCount
=
parameterDict
[
'tablesPerStb'
],
ts_start
=
parameterDict
[
'startTs'
],
...
...
@@ -315,7 +315,7 @@ class TDTestCase:
rowsPerStable
=
parameterDict
[
'rowsPerTable'
]
*
parameterDict
[
'tablesPerStb'
]
self
.
checkData
(
dbname
=
parameterDict
[
'dbname'
],
stbname
=
parameterDict
[
'stbname'
],
stableCount
=
parameterDict
[
'threadNumbersCtb'
],
CtableCount
=
tableCount
,
rowsPerSTable
=
rowsPerStable
)
def
test_case3
(
self
):
#stableCount=threadNumbersCtb
parameterDict
=
{
'vgroups'
:
1
,
\
...
...
@@ -327,21 +327,21 @@ class TDTestCase:
'stbname'
:
'stb1'
,
\
'host'
:
'localhost'
,
\
'startTs'
:
1640966400000
}
# 2022-01-01 00:00:00.000
self
.
taosBenchCreate
(
parameterDict
[
'host'
],
"no"
,
parameterDict
[
'dbname'
],
parameterDict
[
'stbname'
],
parameterDict
[
'vgroups'
],
parameterDict
[
'threadNumbersCtb'
],
parameterDict
[
'dbname'
],
parameterDict
[
'stbname'
],
parameterDict
[
'vgroups'
],
parameterDict
[
'threadNumbersCtb'
],
parameterDict
[
'tablesPerStb'
])
tableCount
=
parameterDict
[
'threadNumbersCtb'
]
*
parameterDict
[
'tablesPerStb'
]
rowsPerStable
=
parameterDict
[
'rowsPerTable'
]
*
parameterDict
[
'tablesPerStb'
]
self
.
checkData
(
dbname
=
parameterDict
[
'dbname'
],
stbname
=
parameterDict
[
'stbname'
],
stbname
=
parameterDict
[
'stbname'
],
stableCount
=
parameterDict
[
'threadNumbersCtb'
],
CtableCount
=
tableCount
,
rowsPerSTable
=
rowsPerStable
)
...
...
@@ -353,9 +353,9 @@ class TDTestCase:
# self.taosBenchCreate("db1", "stb1", 4, 5, 100*10000)
# self.taosBenchCreate("db1", "stb1", 1, 5, 100*10000)
return
return
# run case
# run case
def
run
(
self
):
# create database and tables。
...
...
@@ -368,7 +368,7 @@ class TDTestCase:
return
return
#
# add case with filename
#
...
...
tests/system-test/1-insert/insert_drop.py
浏览文件 @
f2807216
...
...
@@ -38,7 +38,7 @@ class TDTestCase:
tlist
=
self
.
genMultiThreadSeq
(
sql_list
)
self
.
multiThreadRun
(
tlist
)
tdSql
.
query
(
f
'show databases'
)
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/system-test/1-insert/mutipythonnodebugtaosd.py
浏览文件 @
f2807216
...
...
@@ -34,14 +34,14 @@ class TDTestCase:
#
# --------------- main frame -------------------
#
def
caseDescription
(
self
):
'''
limit and offset keyword function test cases;
case1: limit offset base function test
case2: offset return valid
'''
return
return
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
...
...
@@ -68,7 +68,7 @@ class TDTestCase:
self
.
ts
=
1500000000000
# run case
# run case
def
run
(
self
):
# test base case
...
...
@@ -79,7 +79,7 @@ class TDTestCase:
# self.test_case2()
# tdLog.debug(" LIMIT test_case2 ............ [OK]")
# stop
# stop
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
@@ -101,7 +101,7 @@ class TDTestCase:
tdSql
.
execute
(
sql
)
sql
=
pre_create
# print(time.time())
# end sql
# end sql
if
sql
!=
pre_create
:
tdSql
.
execute
(
sql
)
exeEndTime
=
time
.
time
()
...
...
@@ -113,7 +113,7 @@ class TDTestCase:
def
newcur
(
self
,
host
,
cfg
):
user
=
"root"
password
=
"taosdata"
port
=
6030
port
=
6030
con
=
taos
.
connect
(
host
=
host
,
user
=
user
,
password
=
password
,
config
=
cfg
,
port
=
port
)
cur
=
con
.
cursor
()
print
(
cur
)
...
...
@@ -123,7 +123,7 @@ class TDTestCase:
host
=
"127.0.0.1"
buildPath
=
self
.
getBuildPath
()
config
=
buildPath
+
"../sim/dnode1/cfg/"
tsql
=
self
.
newcur
(
host
,
config
)
tsql
.
execute
(
"drop database if exists %s"
%
(
dbname
))
tsql
.
execute
(
"create database if not exists %s vgroups %d"
%
(
dbname
,
vgroups
))
...
...
@@ -147,7 +147,7 @@ class TDTestCase:
tsql
.
execute
(
sql
)
sql
=
pre_create
# print(time.time())
# end sql
# end sql
if
sql
!=
pre_create
:
# print(sql)
tsql
.
execute
(
sql
)
...
...
@@ -176,7 +176,7 @@ class TDTestCase:
# print(sql)
tdSql
.
execute
(
sql
)
sql
=
"insert into %s_%d values "
%
(
stbname
,
i
)
# end sql
# end sql
if
sql
!=
pre_insert
:
# print(sql)
tdSql
.
execute
(
sql
)
...
...
@@ -189,7 +189,7 @@ class TDTestCase:
return
# test case1 base
# test case1 base
def
test_case1
(
self
):
tdLog
.
debug
(
"-----create database and tables test------- "
)
# tdSql.execute("drop database if exists db1")
...
...
@@ -220,7 +220,7 @@ class TDTestCase:
threads
=
[]
threadNumbers
=
2
for
i
in
range
(
threadNumbers
):
threads
.
append
(
mp
.
Process
(
target
=
self
.
new_create_tables
,
args
=
(
"db1%d"
%
i
,
vgroups
,
"stb1"
,
0
,
count
,)))
threads
.
append
(
mp
.
Process
(
target
=
self
.
new_create_tables
,
args
=
(
"db1%d"
%
i
,
vgroups
,
"stb1"
,
0
,
count
,)))
start_time
=
time
.
time
()
for
tr
in
threads
:
tr
.
start
()
...
...
@@ -247,7 +247,7 @@ class TDTestCase:
# tdSql.execute("create database db16 vgroups 16")
# self.create_tables("db16", "stb16", 30*10000)
return
return
# test case2 base:insert data
def
test_case2
(
self
):
...
...
@@ -266,7 +266,7 @@ class TDTestCase:
tdSql
.
execute
(
"create database db1 vgroups 1"
)
self
.
create_tables
(
"db1"
,
"stb1"
,
1
*
100
)
self
.
insert_data
(
"db1"
,
"stb1"
,
self
.
ts
,
1
*
50
,
1
*
10000
)
tdSql
.
execute
(
"create database db4 vgroups 4"
)
self
.
create_tables
(
"db4"
,
"stb4"
,
1
*
100
)
...
...
@@ -287,7 +287,7 @@ class TDTestCase:
tdSql
.
execute
(
"create database db16 vgroups 16"
)
self
.
create_tables
(
"db16"
,
"stb16"
,
1
*
100
)
self
.
insert_data
(
"db16"
,
"stb16"
,
self
.
ts
,
1
*
100
,
1
*
10000
)
return
#
...
...
@@ -296,4 +296,4 @@ class TDTestCase:
# tdCases.addWindows(__file__, TDTestCase())
# tdCases.addLinux(__file__, TDTestCase())
case
=
TDTestCase
()
case
.
test_case1
()
\ No newline at end of file
case
.
test_case1
()
tests/system-test/1-insert/opentsdb_json_taosc_insert.py
浏览文件 @
f2807216
此差异已折叠。
点击以展开。
tests/system-test/1-insert/opentsdb_telnet_line_taosc_insert.py
浏览文件 @
f2807216
...
...
@@ -25,19 +25,19 @@ import threading
import
platform
import
io
if
platform
.
system
().
lower
()
==
'windows'
:
sys
.
stdout
=
io
.
TextIOWrapper
(
sys
.
stdout
.
buffer
,
encoding
=
'utf8'
)
sys
.
stdout
=
io
.
TextIOWrapper
(
sys
.
stdout
.
buffer
,
encoding
=
'utf8'
)
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
_conn
=
conn
self
.
_conn
=
conn
self
.
smlChildTableName_value
=
"id"
def
createDb
(
self
,
name
=
"test"
,
db_update_tag
=
0
,
protocol
=
None
):
if
protocol
==
"telnet-tcp"
:
name
=
"opentsdb_telnet"
if
db_update_tag
==
0
:
tdSql
.
execute
(
f
"drop database if exists
{
name
}
"
)
tdSql
.
execute
(
f
"create database if not exists
{
name
}
precision 'us' schemaless 1"
)
...
...
@@ -66,7 +66,7 @@ class TDTestCase:
td_ts
=
time
.
strftime
(
"%Y-%m-%d %H:%M:%S.{}"
.
format
(
ulsec
),
time
.
localtime
(
ts
))
return
td_ts
#return repr(datetime.datetime.strptime(td_ts, "%Y-%m-%d %H:%M:%S.%f"))
def
dateToTs
(
self
,
datetime_input
):
return
int
(
time
.
mktime
(
time
.
strptime
(
datetime_input
,
"%Y-%m-%d %H:%M:%S.%f"
)))
...
...
@@ -191,7 +191,7 @@ class TDTestCase:
tb_name
=
""
td_tag_value_list
.
append
(
self
.
getTdTypeValue
(
elm
.
split
(
"="
)[
1
],
"tag"
)[
1
])
td_tag_type_list
.
append
(
self
.
getTdTypeValue
(
elm
.
split
(
"="
)[
1
],
"tag"
)[
0
])
col_name_list
.
append
(
'_value'
)
col_value_list
.
append
(
stb_col_value
)
...
...
@@ -218,7 +218,7 @@ class TDTestCase:
t4
=
"9223372036854775807i64"
,
t5
=
"11.12345f32"
,
t6
=
"22.123456789f64"
,
t7
=
"
\"
binaryTagValue
\"
"
,
t8
=
"L
\"
ncharTagValue
\"
"
,
ts
=
"1626006833641"
,
id_noexist_tag
=
None
,
id_change_tag
=
None
,
id_upper_tag
=
None
,
id_mixul_tag
=
None
,
id_double_tag
=
None
,
t_add_tag
=
None
,
t_mul_tag
=
None
,
c_multi_tag
=
None
,
c_blank_tag
=
None
,
t_blank_tag
=
None
,
t_add_tag
=
None
,
t_mul_tag
=
None
,
c_multi_tag
=
None
,
c_blank_tag
=
None
,
t_blank_tag
=
None
,
chinese_tag
=
None
,
multi_field_tag
=
None
,
point_trans_tag
=
None
,
protocol
=
None
,
tcp_keyword_tag
=
None
):
if
stb_name
==
""
:
stb_name
=
tdCom
.
getLongName
(
len
=
6
,
mode
=
"letters"
)
...
...
@@ -268,7 +268,7 @@ class TDTestCase:
if
protocol
==
"telnet-tcp"
:
sql_seq
=
'put '
+
sql_seq
+
'
\n
'
return
sql_seq
,
stb_name
def
genMulTagColStr
(
self
,
genType
,
count
=
1
):
"""
genType must be tag/col
...
...
@@ -365,10 +365,10 @@ class TDTestCase:
for
t_type
in
full_type_list
:
input_sql
,
stb_name
=
self
.
genFullTypeSql
(
t0
=
t_type
,
protocol
=
protocol
)
self
.
resCmp
(
input_sql
,
stb_name
,
protocol
=
protocol
)
def
symbolsCheckCase
(
self
,
protocol
=
None
):
"""
check symbols = `~!@#$%^&*()_-+={[}]\|:;'
\"
,<.>/?
check symbols = `~!@#$%^&*()_-+={[}]\|:;'
\"
,<.>/?
"""
'''
please test :
...
...
@@ -424,7 +424,7 @@ class TDTestCase:
raise
Exception
(
"should not reach here"
)
except
SchemalessError
as
err
:
tdSql
.
checkNotEqual
(
err
.
errno
,
0
)
def
idSeqCheckCase
(
self
,
protocol
=
None
):
"""
check id.index in tags
...
...
@@ -434,7 +434,7 @@ class TDTestCase:
tdCom
.
cleanTb
()
input_sql
,
stb_name
=
self
.
genFullTypeSql
(
id_change_tag
=
True
,
protocol
=
protocol
)
self
.
resCmp
(
input_sql
,
stb_name
,
protocol
=
protocol
)
def
idLetterCheckCase
(
self
,
protocol
=
None
):
"""
check id param
...
...
@@ -527,7 +527,7 @@ class TDTestCase:
raise
Exception
(
"should not reach here"
)
except
SchemalessError
as
err
:
tdSql
.
checkNotEqual
(
err
.
errno
,
0
)
def
illegalTsCheckCase
(
self
):
"""
check ts format like 16260068336390us19
...
...
@@ -592,7 +592,7 @@ class TDTestCase:
self
.
_conn
.
schemaless_insert
([
input_sql
],
TDSmlProtocolType
.
TELNET
.
value
,
None
)
raise
Exception
(
"should not reach here"
)
except
SchemalessError
as
err
:
tdSql
.
checkNotEqual
(
err
.
errno
,
0
)
tdSql
.
checkNotEqual
(
err
.
errno
,
0
)
def
tagValueLengthCheckCase
(
self
):
"""
...
...
@@ -673,7 +673,7 @@ class TDTestCase:
except
SchemalessError
as
err
:
tdSql
.
checkNotEqual
(
err
.
errno
,
0
)
# f32
# f32
tdCom
.
cleanTb
()
for
value
in
[
f
"
{
-
3.4028234663852885981170418348451692544
*
(
10
**
38
)
}
f32"
,
f
"
{
3.4028234663852885981170418348451692544
*
(
10
**
38
)
}
f32"
]:
input_sql
,
stb_name
=
self
.
genFullTypeSql
(
value
=
value
)
...
...
@@ -703,12 +703,12 @@ class TDTestCase:
# except SchemalessError as err:
# tdSql.checkNotEqual(err.errno, 0)
# # # binary
# # # binary
# tdCom.cleanTb()
# stb_name = tdCom.getLongName(7, "letters")
# input_sql = f'{stb_name} 1626006833640 "{tdCom.getLongName(16374, "letters")}" t0=t'
# self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
# tdCom.cleanTb()
# input_sql = f'{stb_name} 1626006833640 "{tdCom.getLongName(16375, "letters")}" t0=t'
# try:
...
...
@@ -748,12 +748,12 @@ class TDTestCase:
# i8 i16 i32 i64 f32 f64
for
input_sql
in
[
self
.
genFullTypeSql
(
value
=
"1s2i8"
)[
0
],
self
.
genFullTypeSql
(
value
=
"1s2i8"
)[
0
],
self
.
genFullTypeSql
(
value
=
"1s2i16"
)[
0
],
self
.
genFullTypeSql
(
value
=
"1s2i32"
)[
0
],
self
.
genFullTypeSql
(
value
=
"1s2i64"
)[
0
],
self
.
genFullTypeSql
(
value
=
"11.1s45f32"
)[
0
],
self
.
genFullTypeSql
(
value
=
"11.1s45f64"
)[
0
],
self
.
genFullTypeSql
(
value
=
"11.1s45f64"
)[
0
],
]:
try
:
self
.
_conn
.
schemaless_insert
([
input_sql
],
TDSmlProtocolType
.
TELNET
.
value
,
None
)
...
...
@@ -761,14 +761,14 @@ class TDTestCase:
except
SchemalessError
as
err
:
tdSql
.
checkNotEqual
(
err
.
errno
,
0
)
# check accepted binary and nchar symbols
# check accepted binary and nchar symbols
# # * ~!@#$¥%^&*()-+={}|[]、「」:;
for
symbol
in
list
(
'~!@#$¥%^&*()-+={}|[]、「」:;'
):
input_sql1
=
f
'
{
tdCom
.
getLongName
(
7
,
"letters"
)
}
1626006833640 "abc
{
symbol
}
aaa" t0=t'
input_sql2
=
f
'
{
tdCom
.
getLongName
(
7
,
"letters"
)
}
1626006833640 t t0=t t1="abc
{
symbol
}
aaa"'
self
.
_conn
.
schemaless_insert
([
input_sql1
],
TDSmlProtocolType
.
TELNET
.
value
,
None
)
# self._conn.schemaless_insert([input_sql2], TDSmlProtocolType.TELNET.value, None)
def
blankCheckCase
(
self
):
'''
check blank case
...
...
@@ -853,7 +853,7 @@ class TDTestCase:
check tag count add, stb and tb duplicate
* tag: alter table ...
* col: when update==0 and ts is same, unchange
* so this case tag&&value will be added,
* so this case tag&&value will be added,
* col is added without value when update==0
* col is added with value when update==1
"""
...
...
@@ -869,14 +869,14 @@ class TDTestCase:
if
db_update_tag
==
1
:
self
.
resCmp
(
input_sql
,
stb_name
,
condition
=
f
'where tbname like "
{
tb_name
}
"'
,
none_check_tag
=
True
)
tdSql
.
query
(
f
'select * from
{
stb_name
}
where tbname like "
{
tb_name
}
"'
)
tdSql
.
checkData
(
0
,
11
,
None
)
tdSql
.
checkData
(
0
,
12
,
None
)
tdSql
.
checkData
(
0
,
11
,
None
)
tdSql
.
checkData
(
0
,
12
,
None
)
else
:
self
.
_conn
.
schemaless_insert
([
input_sql
],
TDSmlProtocolType
.
TELNET
.
value
,
None
)
tdSql
.
query
(
f
'select * from
{
stb_name
}
where tbname like "
{
tb_name
}
"'
)
tdSql
.
checkData
(
0
,
1
,
True
)
tdSql
.
checkData
(
0
,
11
,
None
)
tdSql
.
checkData
(
0
,
12
,
None
)
tdSql
.
checkData
(
0
,
1
,
True
)
tdSql
.
checkData
(
0
,
11
,
None
)
tdSql
.
checkData
(
0
,
12
,
None
)
self
.
createDb
()
@
tdCom
.
smlPass
...
...
@@ -952,7 +952,7 @@ class TDTestCase:
tdCom
.
cleanTb
()
stb_name
=
tdCom
.
getLongName
(
8
,
"letters"
)
tdSql
.
execute
(
f
'create stable
{
stb_name
}
(ts timestamp, f int) tags(t1 bigint)'
)
lines
=
[
"st123456 1626006833640 1i64 t1=3i64 t2=4f64 t3=
\"
t3
\"
"
,
"st123456 1626006833641 2i64 t1=4i64 t3=
\"
t4
\"
t2=5f64 t4=5f64"
,
f
'
{
stb_name
}
1626006833642 3i64 t2=5f64 t3=L
\"
ste
\"
'
,
...
...
@@ -970,7 +970,7 @@ class TDTestCase:
tdSql
.
checkRows
(
6
)
tdSql
.
query
(
'select * from st123456'
)
tdSql
.
checkRows
(
5
)
def
multiInsertCheckCase
(
self
,
count
):
"""
test multi insert
...
...
@@ -1014,7 +1014,7 @@ class TDTestCase:
raise
Exception
(
"should not reach here"
)
except
SchemalessError
as
err
:
tdSql
.
checkNotEqual
(
err
.
errno
,
0
)
def
blankColInsertCheckCase
(
self
):
"""
test blank col insert
...
...
@@ -1040,7 +1040,7 @@ class TDTestCase:
raise
Exception
(
"should not reach here"
)
except
SchemalessError
as
err
:
tdSql
.
checkNotEqual
(
err
.
errno
,
0
)
def
chineseCheckCase
(
self
):
"""
check nchar ---> chinese
...
...
@@ -1210,7 +1210,7 @@ class TDTestCase:
self
.
multiThreadRun
(
self
.
genMultiThreadSeq
(
input_sql
))
tdSql
.
query
(
f
"show tables;"
)
tdSql
.
checkRows
(
5
)
def
sStbStbDdataInsertMultiThreadCheckCase
(
self
):
"""
thread input same stb tb, different data, result keep first data
...
...
@@ -1248,7 +1248,7 @@ class TDTestCase:
tdSql
.
checkEqual
(
tb_name
,
expected_tb_name
)
tdSql
.
query
(
f
"select * from
{
stb_name
}
;"
)
tdSql
.
checkRows
(
1
)
if
self
.
smlChildTableName_value
==
"ID"
else
tdSql
.
checkRows
(
6
)
def
sStbStbDdataMtInsertMultiThreadCheckCase
(
self
):
"""
thread input same stb tb, different data, minus columes and tags, result keep first data
...
...
@@ -1466,7 +1466,7 @@ class TDTestCase:
def
run
(
self
):
print
(
"running {}"
.
format
(
__file__
))
try
:
self
.
createDb
()
self
.
runAll
()
...
...
tests/system-test/1-insert/table_comment.py
浏览文件 @
f2807216
...
...
@@ -42,7 +42,7 @@ class TDTestCase:
self
.
comment_flag_list
=
[
True
,
False
]
def
__set_and_alter_comment
(
self
,
tb_type
=
''
,
comment_flag
=
False
):
column_sql
=
''
tag_sql
=
''
for
k
,
v
in
self
.
column_dict
.
items
():
...
...
@@ -78,7 +78,7 @@ class TDTestCase:
tdSql
.
execute
(
f
'create
{
operation
}
{
self
.
stbname
}
(
{
column_sql
[:
-
1
]
}
) tags(
{
tag_sql
[:
-
1
]
}
) comment "
{
comment_info
}
"'
)
self
.
check_comment_info
(
comment_info
,
'stable'
)
self
.
alter_comment
(
self
.
stbname
,
'stable'
)
tdSql
.
execute
(
f
'drop table
{
self
.
stbname
}
'
)
tdSql
.
execute
(
f
'drop table
{
self
.
stbname
}
'
)
elif
tb_type
==
'child_table'
:
tdSql
.
execute
(
f
'create table if not exists
{
self
.
stbname
}
(
{
column_sql
[:
-
1
]
}
) tags(
{
tag_sql
[:
-
1
]
}
)'
)
if
comment_flag
==
False
:
...
...
@@ -122,7 +122,7 @@ class TDTestCase:
for
flag
in
comment_flag
:
self
.
__set_and_alter_comment
(
tb
,
flag
)
tdSql
.
execute
(
'drop database db'
)
def
run
(
self
):
self
.
comment_check_case
(
self
.
table_type_list
,
self
.
comment_flag_list
)
...
...
@@ -131,4 +131,4 @@ class TDTestCase:
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
\ No newline at end of file
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/system-test/1-insert/table_param_ttl.py
浏览文件 @
f2807216
...
...
@@ -20,7 +20,7 @@ class TDTestCase:
updatecfgDict
=
{
'ttlUnit'
:
5
,
'ttlPushInterval'
:
3
}
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
tdSql
.
init
(
conn
.
cursor
())
self
.
ntbname
=
'ntb'
self
.
stbname
=
'stb'
self
.
tbnum
=
10
...
...
tests/system-test/1-insert/test_stmt_muti_insert_query.py
浏览文件 @
f2807216
...
...
@@ -38,7 +38,7 @@ class TDTestCase:
case1: limit offset base function test
case2: offset return valid
'''
return
return
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
...
...
@@ -64,7 +64,7 @@ class TDTestCase:
# self.create_tables();
self
.
ts
=
1500000000000
# stop
# stop
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
@@ -76,7 +76,7 @@ class TDTestCase:
def
newcon
(
self
,
host
,
cfg
):
user
=
"root"
password
=
"taosdata"
port
=
6030
port
=
6030
con
=
taos
.
connect
(
host
=
host
,
user
=
user
,
password
=
password
,
config
=
cfg
,
port
=
port
)
print
(
con
)
return
con
...
...
@@ -126,14 +126,14 @@ class TDTestCase:
end
=
datetime
.
now
()
print
(
"elapsed time: "
,
end
-
start
)
assert
stmt
.
affected_rows
==
3
#query 1
querystmt
=
conn
.
statement
(
"select ?,bu from stb1"
)
queryparam
=
new_bind_params
(
1
)
print
(
type
(
queryparam
))
queryparam
[
0
].
binary
(
"ts"
)
querystmt
.
bind_param
(
queryparam
)
querystmt
.
execute
()
querystmt
.
execute
()
result
=
querystmt
.
use_result
()
# rows=result.fetch_all()
# print( querystmt.use_result())
...
...
@@ -152,7 +152,7 @@ class TDTestCase:
print
(
type
(
queryparam1
))
queryparam1
[
0
].
int
(
4
)
querystmt1
.
bind_param
(
queryparam1
)
querystmt1
.
execute
()
querystmt1
.
execute
()
result1
=
querystmt1
.
use_result
()
rows1
=
result1
.
fetch_all
()
print
(
rows1
)
...
...
@@ -176,10 +176,10 @@ class TDTestCase:
host
=
"localhost"
connectstmt
=
self
.
newcon
(
host
,
config
)
self
.
test_stmt_insert_multi
(
connectstmt
)
return
return
# add case with filename
#
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
\ No newline at end of file
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/system-test/1-insert/test_stmt_set_tbname_tag.py
浏览文件 @
f2807216
...
...
@@ -38,7 +38,7 @@ class TDTestCase:
case1: limit offset base function test
case2: offset return valid
'''
return
return
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
...
...
@@ -64,7 +64,7 @@ class TDTestCase:
# self.create_tables();
self
.
ts
=
1500000000000
# stop
# stop
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
@@ -76,7 +76,7 @@ class TDTestCase:
def
newcon
(
self
,
host
,
cfg
):
user
=
"root"
password
=
"taosdata"
port
=
6030
port
=
6030
con
=
taos
.
connect
(
host
=
host
,
user
=
user
,
password
=
password
,
config
=
cfg
,
port
=
port
)
tdLog
.
debug
(
con
)
return
con
...
...
@@ -84,7 +84,7 @@ class TDTestCase:
def
stmtExe
(
self
,
conn
,
sql
,
bindStat
):
queryStat
=
conn
.
statement
(
"%s"
%
sql
)
queryStat
.
bind_param
(
bindStat
)
queryStat
.
execute
()
queryStat
.
execute
()
result
=
queryStat
.
use_result
()
rows
=
result
.
fetch_all
()
return
rows
...
...
@@ -101,7 +101,7 @@ class TDTestCase:
ff float, dd double, bb binary(100), nn nchar(100), tt timestamp , vc varchar(100)) tags (t1 timestamp, t2 bool,
\
t3 tinyint, t4 tinyint, t5 smallint, t6 int, t7 bigint, t8 tinyint unsigned, t9 smallint unsigned,
\
t10 int unsigned, t11 bigint unsigned, t12 float, t13 double, t14 binary(100), t15 nchar(100), t16 timestamp)"
%
stablename
)
stmt
=
conn
.
statement
(
"insert into ? using log tags (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
\
values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
)
tags
=
new_bind_params
(
16
)
...
...
@@ -140,13 +140,13 @@ class TDTestCase:
params
[
14
].
nchar
([
"涛思数据"
,
None
,
"a long string with 中文?字符"
])
params
[
15
].
timestamp
([
None
,
None
,
1626861392591
])
params
[
16
].
binary
([
"涛思数据16"
,
None
,
None
])
stmt
.
bind_param_batch
(
params
)
stmt
.
execute
()
assert
stmt
.
affected_rows
==
3
#query all
#query all
queryparam
=
new_bind_params
(
1
)
queryparam
[
0
].
int
(
10
)
rows
=
self
.
stmtExe
(
conn
,
"select * from log where bu < ?"
,
queryparam
)
...
...
@@ -189,7 +189,7 @@ class TDTestCase:
#query: conversion Functions
queryparam
=
new_bind_params
(
1
)
queryparam
[
0
].
binary
(
'1232a'
)
queryparam
[
0
].
binary
(
'1232a'
)
rows
=
self
.
stmtExe
(
conn
,
"select cast( ? as bigint) from log"
,
queryparam
)
tdLog
.
debug
(
"assert 5th case %s"
%
rows
)
assert
rows
[
0
][
0
]
==
1232
,
'5th.1 case is failed'
...
...
@@ -210,7 +210,7 @@ class TDTestCase:
tdLog
.
debug
(
"assert 7th case %s"
%
rows
)
assert
rows
[
0
][
0
]
==
1
,
'7th case is failed'
assert
rows
[
1
][
0
]
==
1
,
'7th case is failed'
#query: aggregate Functions
queryparam
=
new_bind_params
(
1
)
queryparam
[
0
].
int
(
123
)
...
...
@@ -238,7 +238,7 @@ class TDTestCase:
# conn.execute("drop database if exists %s" % dbname)
conn
.
close
()
except
Exception
as
err
:
# conn.execute("drop database if exists %s" % dbname)
conn
.
close
()
...
...
@@ -251,10 +251,10 @@ class TDTestCase:
connectstmt
=
self
.
newcon
(
host
,
config
)
self
.
test_stmt_set_tbname_tag
(
connectstmt
)
return
return
# add case with filename
#
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
\ No newline at end of file
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/system-test/1-insert/update_data.py
浏览文件 @
f2807216
...
...
@@ -47,7 +47,7 @@ class TDTestCase:
'col13'
:
f
'nchar(
{
self
.
str_length
}
)'
,
'col_ts'
:
'timestamp'
}
def
data_check
(
self
,
tbname
,
col_name
,
col_type
,
value
):
tdSql
.
query
(
f
'select
{
col_name
}
from
{
tbname
}
'
)
if
col_type
.
lower
()
==
'float'
or
col_type
.
lower
()
==
'double'
:
...
...
@@ -121,9 +121,9 @@ class TDTestCase:
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
}
)'
)
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
.
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
}
)'
)
...
...
@@ -136,9 +136,9 @@ class TDTestCase:
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
}
)'
)
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
.
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
}
'
)
...
...
@@ -182,9 +182,9 @@ class TDTestCase:
elif
col_type
.
lower
()
==
'bigint unsigned'
:
self
.
update_and_check_data
(
tbname
,
col_name
,
col_type
,
up_unbigint
,
dbname
)
elif
col_type
.
lower
()
==
'bool'
:
self
.
update_and_check_data
(
tbname
,
col_name
,
col_type
,
up_bool
,
dbname
)
self
.
update_and_check_data
(
tbname
,
col_name
,
col_type
,
up_bool
,
dbname
)
elif
col_type
.
lower
()
==
'float'
:
self
.
update_and_check_data
(
tbname
,
col_name
,
col_type
,
up_float
,
dbname
)
self
.
update_and_check_data
(
tbname
,
col_name
,
col_type
,
up_float
,
dbname
)
elif
col_type
.
lower
()
==
'double'
:
self
.
update_and_check_data
(
tbname
,
col_name
,
col_type
,
up_double
,
dbname
)
elif
'binary'
in
col_type
.
lower
():
...
...
@@ -248,10 +248,10 @@ class TDTestCase:
self
.
update_check
()
self
.
update_check_error
()
# i+=1
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
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/system-test/1-insert/update_data_muti_rows.py
浏览文件 @
f2807216
...
...
@@ -87,7 +87,7 @@ class TDTestCase:
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'
:
...
...
@@ -107,16 +107,16 @@ class TDTestCase:
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"
]
}
)'
)
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"
]
}
)'
)
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'
]
}
")'''
)
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
)
...
...
@@ -170,10 +170,10 @@ class TDTestCase:
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
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/system-test/2-query/distribute_agg_apercentile.py
浏览文件 @
f2807216
...
...
@@ -141,8 +141,8 @@ class TDTestCase:
query_data
=
tdSql
.
queryResult
# nest query for support max
tdSql
.
query
(
f
"select apercentile(c2+2,10)+1 from (select max(c1) c2 from
{
dbname
}
.stb1)"
)
tdSql
.
checkData
(
0
,
0
,
31.000000000
)
#
tdSql.query(f"select apercentile(c2+2,10)+1 from (select max(c1) c2 from {dbname}.stb1)")
#
tdSql.checkData(0,0,31.000000000)
tdSql
.
query
(
f
"select apercentile(c1+2,10)+1 as c2 from (select ts ,c1 ,c2 from
{
dbname
}
.stb1)"
)
tdSql
.
checkData
(
0
,
0
,
7.560701700
)
tdSql
.
query
(
f
"select apercentile(a+2,10)+1 as c2 from (select ts ,abs(c1) a ,c2 from
{
dbname
}
.stb1)"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录