Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2a819ec6
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2a819ec6
编写于
11月 30, 2022
作者:
K
kailixu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: column/row support up to 64k
上级
105469d1
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
131 addition
and
120 deletion
+131
-120
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+5
-4
src/inc/taosdef.h
src/inc/taosdef.h
+5
-30
tests/pytest/insert/openTsdbTelnetLinesInsert.py
tests/pytest/insert/openTsdbTelnetLinesInsert.py
+4
-4
tests/pytest/tools/taosdemoAllTest/TD-5213/insert4096columns_not_use_taosdemo.py
...demoAllTest/TD-5213/insert4096columns_not_use_taosdemo.py
+17
-17
tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json
...t/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json
+2
-2
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py
...s/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py
+17
-6
tests/robust/robust.c
tests/robust/robust.c
+1
-1
tests/script/general/compute/cast_query1.sim
tests/script/general/compute/cast_query1.sim
+2
-2
tests/system-test/5-taos-tools/taosbenchmark/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json
...t/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json
+2
-2
tests/system-test/5-taos-tools/taosbenchmark/taosdemoTestInsertShell.py
...est/5-taos-tools/taosbenchmark/taosdemoTestInsertShell.py
+76
-52
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
2a819ec6
...
...
@@ -1688,8 +1688,8 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
return
false
;
}
if
((
p
->
type
==
TSDB_DATA_TYPE_BINARY
&&
p
->
bytes
<=
0
)
||
(
p
->
type
==
TSDB_DATA_TYPE_NCHAR
&&
p
->
bytes
<=
0
))
{
if
((
p
->
type
==
TSDB_DATA_TYPE_BINARY
&&
(
p
->
bytes
<=
0
||
p
->
bytes
>
TSDB_MAX_BINARY_LEN
)
)
||
(
p
->
type
==
TSDB_DATA_TYPE_NCHAR
&&
(
p
->
bytes
<=
0
||
p
->
bytes
>
TSDB_MAX_NCHAR_LEN
)
))
{
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg7
);
return
false
;
}
...
...
@@ -1803,7 +1803,8 @@ int32_t validateOneTag(SSqlCmd* pCmd, TAOS_FIELD* pTagField) {
}
// binary(val), val can not be equalled to or less than 0
if
((
pTagField
->
type
==
TSDB_DATA_TYPE_BINARY
||
pTagField
->
type
==
TSDB_DATA_TYPE_NCHAR
)
&&
pTagField
->
bytes
<=
0
)
{
if
((
pTagField
->
type
==
TSDB_DATA_TYPE_BINARY
||
pTagField
->
type
==
TSDB_DATA_TYPE_NCHAR
)
&&
(
pTagField
->
bytes
<=
0
||
pTagField
->
bytes
>
TSDB_MAX_TAGS_LEN
))
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg5
);
}
...
...
@@ -5318,7 +5319,7 @@ static int32_t validateSQLExprItem(SSqlCmd* pCmd, tSqlExpr* pExpr,
pList
->
ids
[
pList
->
num
++
]
=
idx
;
*
type
=
SQLEXPR_TYPE_SCALAR
;
}
else
if
(
pExpr
->
type
==
SQL_NODE_DATA_TYPE
)
{
if
(
pExpr
->
dataType
.
type
<
0
||
pExpr
->
dataType
.
bytes
<=
0
)
{
if
(
pExpr
->
dataType
.
type
<
0
||
pExpr
->
dataType
.
bytes
<=
0
||
pExpr
->
dataType
.
bytes
>
TSDB_MAX_FIELD_LEN
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
*
type
=
SQLEXPR_TYPE_VALUE
;
...
...
src/inc/taosdef.h
浏览文件 @
2a819ec6
...
...
@@ -226,30 +226,11 @@ do { \
#define TSDB_APPNAME_LEN TSDB_UNI_LEN
#if 1
/**
* In some scenarios uint16_t (0~65535) is used to store the row len.
* - Firstly, we use 65531(65535 - 4), as the SDataRow/SKVRow contains 4 bits header.
* - Secondly, if all cols are VarDataT type except primary key, we need 4 bits to store the offset, thus
* the final value is 65531-(4096-1)*4 = 49151.
* uint16_t (0~65535) is used to store the row len, and SDataRow contains 4 bits header.
* history: 49151->65531
*/
#define TSDB_MAX_BYTES_PER_ROW 65527
// 49151
// 65527
#endif
/**
* In some scenarios uint16_t (0~65535) is used to store the row len.
* - Firstly, we use 65531(65535 - 4), as the SDataRow contains 4 bits header.
* - Secondly, if all cols are VarDataT type except primary key, we need 4 bits to store the offset, thus
* the final value is [65531 - (4096-1)*4 = 49151, 65531 - (2-1)*4 = 65527]
* -
*/
// [49151, min(65527, RPC_MAX_UDP_SIZE)]
#if 0
#define TSDB_MAX_BYTES_PER_ROW_BY_COL(c) (65535 - (c) << 2) // 65531 - (col-1)*4
#endif
#define TSDB_MAX_BYTES_PER_ROW 65531
#define TSDB_MAX_TAGS_LEN 16384
#define TSDB_MAX_JSON_TAGS_LEN (4096 * TSDB_NCHAR_SIZE + 2 + 1) // 2->var_header_len 1->type
...
...
@@ -391,14 +372,8 @@ do { \
#define TSDB_MAX_UNION_CLAUSE 5
#define TSDB_MAX_FIELD_LEN 65519
// 16384
// 65519
// #define TSDB_MAX_BINARY_LEN (TSDB_MAX_FIELD_LEN - TSDB_KEYSIZE) // keep 16384 => 65511
// #define TSDB_MAX_NCHAR_LEN (TSDB_MAX_FIELD_LEN - TSDB_KEYSIZE) // keep 16384 => 65511
#define TSDB_MAX_BINARY_LEN TSDB_MAX_FIELD_LEN // keep 16384 => 65511
#define TSDB_MAX_NCHAR_LEN TSDB_MAX_FIELD_LEN // keep 16384 => 65511
#define TSDB_MAX_BINARY_LEN TSDB_MAX_FIELD_LEN // 16384:65519
#define TSDB_MAX_NCHAR_LEN TSDB_MAX_FIELD_LEN // 16384:65519
#define PRIMARYKEY_TIMESTAMP_COL_INDEX 0
...
...
tests/pytest/insert/openTsdbTelnetLinesInsert.py
浏览文件 @
2a819ec6
...
...
@@ -702,11 +702,11 @@ class TDTestCase:
# # binary
tdCom
.
cleanTb
()
stb_name
=
tdCom
.
getLongName
(
7
,
"letters"
)
input_sql
=
f
'
{
stb_name
}
1626006833640 "
{
tdCom
.
getLongName
(
16374
,
"letters"
)
}
" t0=t'
input_sql
=
f
'
{
stb_name
}
1626006833640 "
{
tdCom
.
getLongName
(
65517
,
"letters"
)
}
" t0=t'
self
.
_conn
.
schemaless_insert
([
input_sql
],
TDSmlProtocolType
.
TELNET
.
value
,
None
)
tdCom
.
cleanTb
()
input_sql
=
f
'
{
stb_name
}
1626006833640 "
{
tdCom
.
getLongName
(
6551
4
,
"letters"
)
}
" t0=t'
input_sql
=
f
'
{
stb_name
}
1626006833640 "
{
tdCom
.
getLongName
(
6551
8
,
"letters"
)
}
" t0=t'
try
:
self
.
_conn
.
schemaless_insert
([
input_sql
],
TDSmlProtocolType
.
TELNET
.
value
,
None
)
raise
Exception
(
"should not reach here"
)
...
...
@@ -717,11 +717,11 @@ class TDTestCase:
# * legal nchar could not be larger than 16374/4
tdCom
.
cleanTb
()
stb_name
=
tdCom
.
getLongName
(
7
,
"letters"
)
input_sql
=
f
'
{
stb_name
}
1626006833640 L"
{
tdCom
.
getLongName
(
4093
,
"letters"
)
}
" t0=t'
input_sql
=
f
'
{
stb_name
}
1626006833640 L"
{
tdCom
.
getLongName
(
16379
,
"letters"
)
}
" t0=t'
self
.
_conn
.
schemaless_insert
([
input_sql
],
TDSmlProtocolType
.
TELNET
.
value
,
None
)
tdCom
.
cleanTb
()
input_sql
=
f
'
{
stb_name
}
1626006833640 L"
{
tdCom
.
getLongName
(
163
79
,
"letters"
)
}
" t0=t'
input_sql
=
f
'
{
stb_name
}
1626006833640 L"
{
tdCom
.
getLongName
(
163
80
,
"letters"
)
}
" t0=t'
try
:
self
.
_conn
.
schemaless_insert
([
input_sql
],
TDSmlProtocolType
.
TELNET
.
value
,
None
)
raise
Exception
(
"should not reach here"
)
...
...
tests/pytest/tools/taosdemoAllTest/TD-5213/insert4096columns_not_use_taosdemo.py
浏览文件 @
2a819ec6
...
...
@@ -288,9 +288,9 @@ class TDTestCase:
tdSql
.
checkRows
(
4
*
self
.
num
)
tdSql
.
checkCols
(
4096
)
#define TSDB_MAX_BYTES_PER_ROW 655
27
[old:1024 && 16384 && 49151]
#define TSDB_MAX_BYTES_PER_ROW 655
31
[old:1024 && 16384 && 49151]
#ts:8\int:4\smallint:2\bigint:8\bool:1\float:4\tinyint:1\nchar:4*()+2[offset]\binary:1*()+2[offset]
tdLog
.
info
(
'test regular_table max bytes per row 655
27
'
)
tdLog
.
info
(
'test regular_table max bytes per row 655
31
'
)
sql
=
"create table regular_table_5(ts timestamp, "
for
i
in
range
(
500
):
sql
+=
"int_%d int, "
%
(
i
+
1
)
...
...
@@ -312,12 +312,12 @@ class TDTestCase:
sql
+=
"binary_%d binary(34), "
%
(
i
+
1
)
for
i
in
range
(
4090
,
4094
):
sql
+=
"timestamp_%d timestamp, "
%
(
i
+
1
)
sql
+=
"col4095 binary(1408
1
))"
sql
+=
"col4095 binary(1408
5
))"
tdSql
.
execute
(
sql
)
tdSql
.
query
(
"select * from regular_table_5"
)
tdSql
.
checkCols
(
4096
)
# TD-5324
sql
=
"alter table regular_table_5 modify column col4095 binary(1408
2
); "
sql
=
"alter table regular_table_5 modify column col4095 binary(1408
6
); "
tdSql
.
error
(
sql
)
# drop and add
...
...
@@ -326,16 +326,16 @@ class TDTestCase:
sql
=
"select * from regular_table_5; "
tdSql
.
query
(
sql
)
tdSql
.
checkCols
(
4095
)
sql
=
"alter table regular_table_5 add column col4095 binary(1408
2
); "
sql
=
"alter table regular_table_5 add column col4095 binary(1408
6
); "
tdSql
.
error
(
sql
)
sql
=
"alter table regular_table_5 add column col4095 binary(1408
1
); "
sql
=
"alter table regular_table_5 add column col4095 binary(1408
5
); "
tdSql
.
execute
(
sql
)
sql
=
"select * from regular_table_5; "
tdSql
.
query
(
sql
)
tdSql
.
checkCols
(
4096
)
#out TSDB_MAX_BYTES_PER_ROW 655
27
tdLog
.
info
(
'test regular_table max bytes per row out 655
27
'
)
#out TSDB_MAX_BYTES_PER_ROW 655
31
tdLog
.
info
(
'test regular_table max bytes per row out 655
31
'
)
sql
=
"create table regular_table_6(ts timestamp, "
for
i
in
range
(
500
):
sql
+=
"int_%d int, "
%
(
i
+
1
)
...
...
@@ -357,7 +357,7 @@ class TDTestCase:
sql
+=
"binary_%d binary(34), "
%
(
i
+
1
)
for
i
in
range
(
4090
,
4094
):
sql
+=
"timestamp_%d timestamp, "
%
(
i
+
1
)
sql
+=
"col4095 binary(1408
2
))"
sql
+=
"col4095 binary(1408
6
))"
tdLog
.
info
(
len
(
sql
))
tdSql
.
error
(
sql
)
...
...
@@ -575,9 +575,9 @@ class TDTestCase:
tdSql
.
checkRows
(
3
*
self
.
num
)
tdSql
.
checkCols
(
4092
)
#define TSDB_MAX_BYTES_PER_ROW 655
27
TSDB_MAX_TAGS_LEN 16384
#define TSDB_MAX_BYTES_PER_ROW 655
31
TSDB_MAX_TAGS_LEN 16384
#ts:8\int:4\smallint:2\bigint:8\bool:1\float:4\tinyint:1\nchar:4*()+2[offset]\binary:1*()+2[offset]
tdLog
.
info
(
'test super table max bytes per row 655
27
'
)
tdLog
.
info
(
'test super table max bytes per row 655
31
'
)
sql
=
"create table stable_4(ts timestamp, "
for
i
in
range
(
500
):
sql
+=
"int_%d int, "
%
(
i
+
1
)
...
...
@@ -597,7 +597,7 @@ class TDTestCase:
sql
+=
"nchar_%d nchar(20), "
%
(
i
+
1
)
for
i
in
range
(
3800
,
4090
):
sql
+=
"binary_%d binary(34), "
%
(
i
+
1
)
sql
+=
"col4091 binary(1411
3
))"
sql
+=
"col4091 binary(1411
7
))"
sql
+=
" tags (loc nchar(10),tag_1 int,tag_2 int,tag_3 int) "
tdSql
.
execute
(
sql
)
sql
=
'''create table table_40 using stable_4
...
...
@@ -614,9 +614,9 @@ class TDTestCase:
sql
=
"select * from stable_4; "
tdSql
.
query
(
sql
)
tdSql
.
checkCols
(
4095
)
sql
=
"alter table stable_4 add column col4091 binary(1411
4
); "
sql
=
"alter table stable_4 add column col4091 binary(1411
8
); "
tdSql
.
error
(
sql
)
sql
=
"alter table stable_4 add column col4091 binary(1411
3
); "
sql
=
"alter table stable_4 add column col4091 binary(1411
7
); "
tdSql
.
execute
(
sql
)
sql
=
"select * from stable_4; "
tdSql
.
query
(
sql
)
...
...
@@ -635,7 +635,7 @@ class TDTestCase:
sql
=
"alter table stable_4 add tag loc1 nchar(10); "
tdSql
.
error
(
sql
)
tdLog
.
info
(
'test super table max bytes per row 655
27
'
)
tdLog
.
info
(
'test super table max bytes per row 655
31
'
)
sql
=
"create table stable_5(ts timestamp, "
for
i
in
range
(
500
):
sql
+=
"int_%d int, "
%
(
i
+
1
)
...
...
@@ -655,7 +655,7 @@ class TDTestCase:
sql
+=
"nchar_%d nchar(20), "
%
(
i
+
1
)
for
i
in
range
(
3800
,
4090
):
sql
+=
"binary_%d binary(34), "
%
(
i
+
1
)
sql
+=
"col4091 binary(1411
4
))"
sql
+=
"col4091 binary(1411
8
))"
sql
+=
" tags (loc nchar(10),tag_1 int,tag_2 int,tag_3 int) "
tdSql
.
error
(
sql
)
...
...
@@ -686,7 +686,7 @@ class TDTestCase:
sql
=
"alter table stable_1 add tag max int; "
tdSql
.
error
(
sql
)
# TD-5324
sql
=
"alter table stable_4 modify column col4091 binary(1411
4
); "
sql
=
"alter table stable_4 modify column col4091 binary(1411
8
); "
tdSql
.
error
(
sql
)
sql
=
"alter table stable_4 modify tag loc nchar(20); "
tdSql
.
query
(
"select * from table_40"
)
...
...
tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json
浏览文件 @
2a819ec6
...
...
@@ -54,7 +54,7 @@
"sample_format"
:
"csv"
,
"sample_file"
:
"./sample.csv"
,
"tags_file"
:
""
,
"columns"
:
[{
"type"
:
"BINARY"
,
"len"
:
6551
4
,
"count"
:
1
}],
"columns"
:
[{
"type"
:
"BINARY"
,
"len"
:
6551
8
,
"count"
:
1
}],
"tags"
:
[{
"type"
:
"TINYINT"
,
"count"
:
2
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
5
}]
},
{
...
...
@@ -80,7 +80,7 @@
"sample_format"
:
"csv"
,
"sample_file"
:
"./sample.csv"
,
"tags_file"
:
""
,
"columns"
:
[{
"type"
:
"BINARY"
,
"len"
:
21831
,
"count"
:
3
},{
"type"
:
"INT"
,
"count"
:
2
},{
"type"
:
"TINYINT"
}],
"columns"
:
[{
"type"
:
"BINARY"
,
"len"
:
21831
,
"count"
:
3
},{
"type"
:
"INT"
,
"count"
:
3
},{
"type"
:
"TINYINT"
}],
"tags"
:
[{
"type"
:
"TINYINT"
,
"count"
:
2
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
5
}]
}]
}]
...
...
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py
浏览文件 @
2a819ec6
...
...
@@ -213,18 +213,29 @@ class TDTestCase:
tdSql
.
query
(
"select count(*) from `test.0`"
)
tdSql
.
checkData
(
0
,
0
,
100
)
# max valid length - row
sql
=
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(16370\)
\
-w 40 -T 8 -i 10 -S 1000 -r 48 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc"
%
(
binPath
,
cfgPath
)
tdLog
.
info
(
"%s"
%
sql
)
assert
os
.
system
(
"%s"
%
sql
)
==
0
# taosdemo error
# too max length
sql
=
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(16379\)
\
-w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc"
%
(
binPath
,
cfgPath
)
# # too max length - column
sql
=
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b NCHAR\(16380\)
\
-w 40 -T 8 -i 10 -S 1000 -r 48 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc"
%
(
binPath
,
cfgPath
)
tdLog
.
info
(
"%s"
%
sql
)
assert
os
.
system
(
"%s"
%
sql
)
!=
0
# too max length - row
sql
=
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(16371\)
\
-w 40 -T 8 -i 10 -S 1000 -r 48 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc"
%
(
binPath
,
cfgPath
)
tdLog
.
info
(
"%s"
%
sql
)
assert
os
.
system
(
"%s"
%
sql
)
!=
0
# error password
sql
=
"%s -u root -c %s -h localhost -P 6030 -p123 -d db1 -a 1 -l 10 -b float,int,NCHAR\(40\)
\
-w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt"
%
(
binPath
,
cfgPath
)
-w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt"
%
(
binPath
,
cfgPath
)
tdLog
.
info
(
"%s"
%
sql
)
assert
os
.
system
(
"%s"
%
sql
)
!=
0
...
...
tests/robust/robust.c
浏览文件 @
2a819ec6
...
...
@@ -195,7 +195,7 @@ void insertImp(void *param) {
for
(
int
j
=
0
;
j
<
arguments
.
table
;
j
++
)
{
sqlLen
+=
sprintf
(
sql
+
sqlLen
,
" s%d_%d values (%ld, %d, %d, %d)"
,
i
,
j
,
time
,
rand
(),
rand
(),
rand
());
count
++
;
if
(
(
1048576
-
sqlLen
)
<
655
27
||
i
==
(
pThread
->
threadId
*
arguments
.
stable
/
arguments
.
client
-
1
))
{
if
(
(
1048576
-
sqlLen
)
<
655
31
||
i
==
(
pThread
->
threadId
*
arguments
.
stable
/
arguments
.
client
-
1
))
{
result
=
taos_query
(
pThread
->
taos
,
sql
);
printf
(
"Thread %d already insert %d rows
\n
"
,
pThread
->
threadId
,
count
);
if
(
result
==
NULL
||
taos_errno
(
result
)
!=
0
)
{
...
...
tests/script/general/compute/cast_query1.sim
浏览文件 @
2a819ec6
...
...
@@ -13,8 +13,8 @@ sql_error select cast(* as bigint) as a from tb1;
sql_error select cast(* as bigint) + 1 as a from tb1;
sql_error select cast(tb1.* as bigint) + 1 as a from tb1;
sql_error select cast(* as bigint) from tb1;
sql_error select cast(c1 as binary(
16384
)) from tb1;
sql_error select cast(c1 as nchar(1638
4
)) from tb1;
sql_error select cast(c1 as binary(
65518
)) from tb1;
sql_error select cast(c1 as nchar(1638
0
)) from tb1;
sql_error select cast(c1 + c2 as bigint) from tb1;
sql_error select cast(13 as binary(0)) from tb1;
sql_error select cast(12 as binary(-1)) from tb1;
...
...
tests/system-test/5-taos-tools/taosbenchmark/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json
浏览文件 @
2a819ec6
...
...
@@ -54,7 +54,7 @@
"sample_format"
:
"csv"
,
"sample_file"
:
"./sample.csv"
,
"tags_file"
:
""
,
"columns"
:
[{
"type"
:
"BINARY"
,
"len"
:
6551
4
,
"count"
:
1
}],
"columns"
:
[{
"type"
:
"BINARY"
,
"len"
:
6551
8
,
"count"
:
1
}],
"tags"
:
[{
"type"
:
"TINYINT"
,
"count"
:
2
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
5
}]
},
{
...
...
@@ -81,7 +81,7 @@
"sample_file"
:
"./sample.csv"
,
"tags_file"
:
""
,
"columns"
:
[{
"type"
:
"BINARY"
,
"len"
:
21831
,
"count"
:
3
},{
"type"
:
"INT"
,
"count"
:
2
},{
"type"
:
"TINYINT"
}],
"tags"
:
[{
"type"
:
"TINYINT"
,
"count"
:
2
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
5
}]
"tags"
:
[{
"type"
:
"TINYINT"
,
"count"
:
3
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
5
}]
}]
}]
}
tests/system-test/5-taos-tools/taosbenchmark/taosdemoTestInsertShell.py
浏览文件 @
2a819ec6
...
...
@@ -24,40 +24,41 @@ class TDTestCase:
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosBenchmark"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
global
cfgPath
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
cfgPath
=
projPath
+
"/community/sim/dnode1/cfg"
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
cfgPath
=
projPath
+
"/sim/dnode1/cfg"
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
# def checkGerData():
def
run
(
self
):
b
uildPath
=
self
.
getBuildPath
(
)
print
(
"%s"
%
cfgPath
)
if
(
b
uild
Path
==
""
):
tdLog
.
exit
(
"taos
d
not found!"
)
b
inPath
=
self
.
getPath
(
"taosBenchmark"
)
print
(
"%s"
%
cfgPath
)
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taos
Benchmark
not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
tdLog
.
info
(
"taosBenchmark found in %s"
%
binPath
)
tdLog
.
info
(
"create super table"
)
# create super table
os
.
system
(
"%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
))
# create super table
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
))
tdSql
.
execute
(
"use db1"
)
tdSql
.
query
(
"describe meters;"
)
tdSql
.
checkRows
(
13
)
...
...
@@ -68,12 +69,13 @@ class TDTestCase:
tdSql
.
query
(
"select count(*) from `test.0`"
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdLog
.
info
(
"create general table -N "
)
tdSql
.
execute
(
"drop database db1;"
)
# create general table -N
os
.
system
(
"%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -N "
%
(
binPath
,
cfgPath
))
# create general table -N
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -N "
%
(
binPath
,
cfgPath
))
tdSql
.
execute
(
"use db1"
)
tdSql
.
query
(
"describe `test.0`;"
)
tdSql
.
checkRows
(
11
)
...
...
@@ -85,8 +87,10 @@ class TDTestCase:
tdLog
.
info
(
"use diffrent interface stmt"
)
tdSql
.
execute
(
"drop database db1;"
)
# use diffrent interface-stmt
os
.
system
(
"%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,BINARY\(4000\) -w 40
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt "
%
(
binPath
,
cfgPath
))
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,BINARY\(4000\) -w 40
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt "
%
(
binPath
,
cfgPath
))
tdSql
.
execute
(
"use db1"
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
...
...
@@ -98,8 +102,10 @@ class TDTestCase:
tdLog
.
info
(
"use diffrent interface rest"
)
tdSql
.
execute
(
"drop database db1;"
)
# use diffrent interface -rest
os
.
system
(
"%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4097
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I rest "
%
(
binPath
,
cfgPath
))
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4097
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I rest "
%
(
binPath
,
cfgPath
))
tdSql
.
execute
(
"use db1"
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
...
...
@@ -111,8 +117,10 @@ class TDTestCase:
tdLog
.
info
(
"use diffrent interface sml"
)
tdSql
.
execute
(
"drop database db1;"
)
# use diffrent interface-sml
os
.
system
(
"%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 1024
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I sml "
%
(
binPath
,
cfgPath
))
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 1024
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I sml "
%
(
binPath
,
cfgPath
))
tdSql
.
execute
(
"use db1"
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
...
...
@@ -122,9 +130,9 @@ class TDTestCase:
tdLog
.
info
(
"all data type"
)
tdSql
.
execute
(
"drop database db1;"
)
# all data type-taosc
os
.
system
(
"%s
taosBenchmark
-u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10
\
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10
\
-b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
))
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
))
tdSql
.
execute
(
"use db1"
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
...
...
@@ -135,9 +143,9 @@ class TDTestCase:
tdLog
.
info
(
"all data type"
)
tdSql
.
execute
(
"drop database db1;"
)
# all data type-stmt
os
.
system
(
"%s
taosBenchmark
-u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10
\
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10
\
-b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt "
%
(
binPath
,
cfgPath
))
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt "
%
(
binPath
,
cfgPath
))
tdSql
.
execute
(
"use db1"
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
...
...
@@ -147,9 +155,9 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
100
)
# all data type-rest
os
.
system
(
"%s
taosBenchmark
-u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10
\
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10
\
-b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I rest "
%
(
binPath
,
cfgPath
))
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I rest "
%
(
binPath
,
cfgPath
))
tdSql
.
execute
(
"use db1"
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
...
...
@@ -159,7 +167,7 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
100
)
# # all data type-rest
# os.system("%s
taosBenchmark
-u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \
# os.system("%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \
# -b INT,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096 \
# -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I sml " % (binPath,cfgPath))
# tdSql.execute("use db1")
...
...
@@ -172,10 +180,10 @@ class TDTestCase:
tdLog
.
info
(
"all data type and interlace rows"
)
tdSql
.
execute
(
"drop database db1;"
)
# all data type
os
.
system
(
"%s
taosBenchmark
-u root -c %s -h localhost -P 6030 -d db3 -a 1 -l 10
\
# all data type
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db3 -a 1 -l 10
\
-b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -B 1000 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
))
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -B 1000 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
))
tdSql
.
execute
(
"use db3"
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
...
...
@@ -185,14 +193,18 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
100
)
tdLog
.
info
(
"all data type and too much para"
)
tdLog
.
info
(
"%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096
\
tdLog
.
info
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test.taosdemo -u root -c %s -h
\
localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
,
cfgPath
))
localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
,
cfgPath
))
tdSql
.
execute
(
"drop database db3;"
)
# repeate parameters
os
.
system
(
"%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096
\
# repeate parameters
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test.taosdemo -u root -c %s -h
\
localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
,
cfgPath
))
localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
,
cfgPath
))
tdSql
.
execute
(
"use db1"
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
...
...
@@ -201,23 +213,35 @@ class TDTestCase:
tdSql
.
query
(
"select count(*) from `test.0`"
)
tdSql
.
checkData
(
0
,
0
,
100
)
# max valid length - row
sql
=
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(16370\)
\
-w 40 -T 8 -i 10 -S 1000 -r 48 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc"
%
(
binPath
,
cfgPath
)
tdLog
.
info
(
"%s"
%
sql
)
assert
os
.
system
(
"%s"
%
sql
)
==
0
# taosdemo error
# too max length
sql
=
"%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(16379\)
\
-w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc"
%
(
binPath
,
cfgPath
)
tdLog
.
info
(
"%s"
%
sql
)
assert
os
.
system
(
"%s"
%
sql
)
!=
0
# error password
sql
=
"%staosBenchmark -u root -c %s -h localhost -P 6030 -p123 -d db1 -a 1 -l 10 -b float,int,NCHAR\(40\)
\
-w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt"
%
(
binPath
,
cfgPath
)
tdLog
.
info
(
"%s"
%
sql
)
assert
os
.
system
(
"%s"
%
sql
)
!=
0
# # too max length - column
sql
=
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b NCHAR\(16380\)
\
-w 40 -T 8 -i 10 -S 1000 -r 48 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc"
%
(
binPath
,
cfgPath
)
tdLog
.
info
(
"%s"
%
sql
)
assert
os
.
system
(
"%s"
%
sql
)
!=
0
# too max length - row
sql
=
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(16371\)
\
-w 40 -T 8 -i 10 -S 1000 -r 48 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc"
%
(
binPath
,
cfgPath
)
tdLog
.
info
(
"%s"
%
sql
)
assert
os
.
system
(
"%s"
%
sql
)
!=
0
# error password
sql
=
"%s -u root -c %s -h localhost -P 6030 -p123 -d db1 -a 1 -l 10 -b float,int,NCHAR\(40\)
\
-w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt"
%
(
binPath
,
cfgPath
)
tdLog
.
info
(
"%s"
%
sql
)
assert
os
.
system
(
"%s"
%
sql
)
!=
0
testcaseFilename
=
os
.
path
.
split
(
__file__
)[
-
1
]
os
.
system
(
"rm -rf ./insert_res*.txt*"
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/%s.sql"
%
testcaseFilename
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/%s.sql"
%
testcaseFilename
)
def
stop
(
self
):
tdSql
.
close
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录