Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
dbd41bff
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看板
未验证
提交
dbd41bff
编写于
1月 02, 2023
作者:
wmmhello
提交者:
GitHub
1月 02, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19307 from taosdata/refact/submit_req_marks
opti:submit req marks
上级
28b0cf94
1cb2e865
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
112 addition
and
138 deletion
+112
-138
source/client/inc/clientSml.h
source/client/inc/clientSml.h
+2
-1
source/client/src/clientSml.c
source/client/src/clientSml.c
+2
-0
source/client/src/clientSmlJson.c
source/client/src/clientSmlJson.c
+20
-15
source/client/src/clientSmlLine.c
source/client/src/clientSmlLine.c
+24
-68
source/client/src/clientSmlTelnet.c
source/client/src/clientSmlTelnet.c
+20
-12
source/client/test/smlTest.cpp
source/client/test/smlTest.cpp
+29
-29
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+4
-4
utils/test/c/sml_test.c
utils/test/c/sml_test.c
+11
-9
未找到文件。
source/client/inc/clientSml.h
浏览文件 @
dbd41bff
...
@@ -185,6 +185,7 @@ typedef struct {
...
@@ -185,6 +185,7 @@ typedef struct {
//
//
SArray
*
preLineTagKV
;
SArray
*
preLineTagKV
;
SArray
*
maxTagKVs
;
SArray
*
preLineColKV
;
SArray
*
preLineColKV
;
SSmlLineInfo
preLine
;
SSmlLineInfo
preLine
;
...
@@ -199,7 +200,7 @@ typedef struct {
...
@@ -199,7 +200,7 @@ typedef struct {
#define IS_SAME_SUPER_TABLE (elements->measureLen == info->preLine.measureLen \
#define IS_SAME_SUPER_TABLE (elements->measureLen == info->preLine.measureLen \
&& memcmp(elements->measure, info->preLine.measure, elements->measureLen) == 0)
&& memcmp(elements->measure, info->preLine.measure, elements->measureLen) == 0)
#define IS_SAME_KEY (
preKV->keyLen == kv.keyLen && memcmp(pre
KV->key, kv.key, kv.keyLen) == 0)
#define IS_SAME_KEY (
maxKV->keyLen == kv.keyLen && memcmp(max
KV->key, kv.key, kv.keyLen) == 0)
extern
int64_t
smlFactorNS
[
3
];
extern
int64_t
smlFactorNS
[
3
];
extern
int64_t
smlFactorS
[
3
];
extern
int64_t
smlFactorS
[
3
];
...
...
source/client/src/clientSml.c
浏览文件 @
dbd41bff
...
@@ -1054,6 +1054,7 @@ void smlDestroyInfo(SSmlHandle *info) {
...
@@ -1054,6 +1054,7 @@ void smlDestroyInfo(SSmlHandle *info) {
taosHashCleanup
(
info
->
pVgHash
);
taosHashCleanup
(
info
->
pVgHash
);
taosArrayDestroy
(
info
->
preLineTagKV
);
taosArrayDestroy
(
info
->
preLineTagKV
);
taosArrayDestroy
(
info
->
maxTagKVs
);
taosArrayDestroy
(
info
->
preLineColKV
);
taosArrayDestroy
(
info
->
preLineColKV
);
if
(
!
info
->
dataFormat
)
{
if
(
!
info
->
dataFormat
)
{
...
@@ -1090,6 +1091,7 @@ SSmlHandle *smlBuildSmlInfo(TAOS *taos) {
...
@@ -1090,6 +1091,7 @@ SSmlHandle *smlBuildSmlInfo(TAOS *taos) {
info
->
dataFormat
=
true
;
info
->
dataFormat
=
true
;
info
->
preLineTagKV
=
taosArrayInit
(
8
,
sizeof
(
SSmlKv
));
info
->
preLineTagKV
=
taosArrayInit
(
8
,
sizeof
(
SSmlKv
));
info
->
maxTagKVs
=
taosArrayInit
(
8
,
sizeof
(
SSmlKv
));
info
->
preLineColKV
=
taosArrayInit
(
8
,
sizeof
(
SSmlKv
));
info
->
preLineColKV
=
taosArrayInit
(
8
,
sizeof
(
SSmlKv
));
if
(
NULL
==
info
->
pVgHash
)
{
if
(
NULL
==
info
->
pVgHash
)
{
...
...
source/client/src/clientSmlJson.c
浏览文件 @
dbd41bff
...
@@ -429,9 +429,8 @@ static inline int32_t smlParseMetricFromJSON(SSmlHandle *info, cJSON *metric, SS
...
@@ -429,9 +429,8 @@ static inline int32_t smlParseMetricFromJSON(SSmlHandle *info, cJSON *metric, SS
const
char
*
jsonName
[
OTD_JSON_FIELDS_NUM
]
=
{
"metric"
,
"timestamp"
,
"value"
,
"tags"
};
const
char
*
jsonName
[
OTD_JSON_FIELDS_NUM
]
=
{
"metric"
,
"timestamp"
,
"value"
,
"tags"
};
static
int32_t
smlGetJsonElements
(
cJSON
*
root
,
cJSON
***
marks
){
static
int32_t
smlGetJsonElements
(
cJSON
*
root
,
cJSON
***
marks
){
cJSON
*
child
=
root
->
child
;
for
(
int
i
=
0
;
i
<
OTD_JSON_FIELDS_NUM
;
++
i
)
{
for
(
int
i
=
0
;
i
<
OTD_JSON_FIELDS_NUM
;
++
i
)
{
cJSON
*
child
=
root
->
child
;
while
(
child
!=
NULL
)
while
(
child
!=
NULL
)
{
{
if
(
strcasecmp
(
child
->
string
,
jsonName
[
i
])
==
0
){
if
(
strcasecmp
(
child
->
string
,
jsonName
[
i
])
==
0
){
...
@@ -441,7 +440,7 @@ static int32_t smlGetJsonElements(cJSON *root, cJSON ***marks){
...
@@ -441,7 +440,7 @@ static int32_t smlGetJsonElements(cJSON *root, cJSON ***marks){
child
=
child
->
next
;
child
=
child
->
next
;
}
}
if
(
*
marks
[
i
]
==
NULL
){
if
(
*
marks
[
i
]
==
NULL
){
uError
(
"smlGetJsonElements error, not find mark:%
s"
,
jsonName
[
i
]);
uError
(
"smlGetJsonElements error, not find mark:%
d:%s"
,
i
,
jsonName
[
i
]);
return
-
1
;
return
-
1
;
}
}
}
}
...
@@ -648,6 +647,7 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
...
@@ -648,6 +647,7 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
int
cnt
=
0
;
int
cnt
=
0
;
SArray
*
preLineKV
=
info
->
preLineTagKV
;
SArray
*
preLineKV
=
info
->
preLineTagKV
;
SArray
*
maxKVs
=
info
->
maxTagKVs
;
bool
isSuperKVInit
=
true
;
bool
isSuperKVInit
=
true
;
SArray
*
superKV
=
NULL
;
SArray
*
superKV
=
NULL
;
if
(
info
->
dataFormat
){
if
(
info
->
dataFormat
){
...
@@ -671,11 +671,12 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
...
@@ -671,11 +671,12 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
if
(
unlikely
(
taosArrayGetSize
(
superKV
)
==
0
)){
if
(
unlikely
(
taosArrayGetSize
(
superKV
)
==
0
)){
isSuperKVInit
=
false
;
isSuperKVInit
=
false
;
}
}
taosArraySetSize
(
preLineKV
,
0
);
taosArraySetSize
(
maxKVs
,
0
);
}
}
}
else
{
}
else
{
taosArraySetSize
(
preLineKV
,
0
);
taosArraySetSize
(
maxKVs
,
0
);
}
}
taosArraySetSize
(
preLineKV
,
0
);
int32_t
tagNum
=
cJSON_GetArraySize
(
tags
);
int32_t
tagNum
=
cJSON_GetArraySize
(
tags
);
if
(
unlikely
(
tagNum
==
0
)){
if
(
unlikely
(
tagNum
==
0
)){
...
@@ -710,14 +711,14 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
...
@@ -710,14 +711,14 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
}
}
if
(
isSameMeasure
){
if
(
isSameMeasure
){
if
(
unlikely
(
cnt
>=
taosArrayGetSize
(
preLineKV
)))
{
if
(
unlikely
(
cnt
>=
taosArrayGetSize
(
maxKVs
)))
{
info
->
dataFormat
=
false
;
info
->
dataFormat
=
false
;
info
->
reRun
=
true
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
SSmlKv
*
preKV
=
(
SSmlKv
*
)
taosArrayGet
(
preLineKV
,
cnt
);
SSmlKv
*
maxKV
=
(
SSmlKv
*
)
taosArrayGet
(
maxKVs
,
cnt
);
if
(
unlikely
(
kv
.
length
>
pre
KV
->
length
)){
if
(
unlikely
(
kv
.
length
>
max
KV
->
length
)){
pre
KV
->
length
=
kv
.
length
;
max
KV
->
length
=
kv
.
length
;
SSmlSTableMeta
*
tableMeta
=
(
SSmlSTableMeta
*
)
nodeListGet
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
NULL
);
SSmlSTableMeta
*
tableMeta
=
(
SSmlSTableMeta
*
)
nodeListGet
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
NULL
);
ASSERT
(
tableMeta
!=
NULL
);
ASSERT
(
tableMeta
!=
NULL
);
...
@@ -737,11 +738,11 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
...
@@ -737,11 +738,11 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
info
->
reRun
=
true
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
SSmlKv
*
pre
KV
=
(
SSmlKv
*
)
taosArrayGet
(
superKV
,
cnt
);
SSmlKv
*
max
KV
=
(
SSmlKv
*
)
taosArrayGet
(
superKV
,
cnt
);
if
(
unlikely
(
kv
.
length
>
pre
KV
->
length
))
{
if
(
unlikely
(
kv
.
length
>
max
KV
->
length
))
{
pre
KV
->
length
=
kv
.
length
;
max
KV
->
length
=
kv
.
length
;
}
else
{
}
else
{
kv
.
length
=
pre
KV
->
length
;
kv
.
length
=
max
KV
->
length
;
}
}
info
->
needModifySchema
=
true
;
info
->
needModifySchema
=
true
;
...
@@ -753,11 +754,12 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
...
@@ -753,11 +754,12 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
}
else
{
}
else
{
taosArrayPush
(
superKV
,
&
kv
);
taosArrayPush
(
superKV
,
&
kv
);
}
}
taosArrayPush
(
preLineKV
,
&
kv
);
taosArrayPush
(
maxKVs
,
&
kv
);
}
}
}
else
{
}
else
{
taosArrayPush
(
preLineKV
,
&
kv
);
taosArrayPush
(
maxKVs
,
&
kv
);
}
}
taosArrayPush
(
preLineKV
,
&
kv
);
cnt
++
;
cnt
++
;
}
}
...
@@ -921,6 +923,9 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo
...
@@ -921,6 +923,9 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo
cJSON
*
tsJson
=
NULL
;
cJSON
*
tsJson
=
NULL
;
cJSON
*
valueJson
=
NULL
;
cJSON
*
valueJson
=
NULL
;
cJSON
*
tagsJson
=
NULL
;
cJSON
*
tagsJson
=
NULL
;
char
*
rootStr
=
cJSON_PrintUnformatted
(
root
);
uError
(
"rootStr:%s"
,
rootStr
);
taosMemoryFree
(
rootStr
);
int32_t
size
=
cJSON_GetArraySize
(
root
);
int32_t
size
=
cJSON_GetArraySize
(
root
);
// outmost json fields has to be exactly 4
// outmost json fields has to be exactly 4
...
...
source/client/src/clientSmlLine.c
浏览文件 @
dbd41bff
...
@@ -57,52 +57,6 @@ uint8_t smlPrecisionConvert[7] = {TSDB_TIME_PRECISION_NANO, TSDB_TIME_PRECISION_
...
@@ -57,52 +57,6 @@ uint8_t smlPrecisionConvert[7] = {TSDB_TIME_PRECISION_NANO, TSDB_TIME_PRECISION_
TSDB_TIME_PRECISION_SECONDS
,
TSDB_TIME_PRECISION_MILLI
,
TSDB_TIME_PRECISION_MICRO
,
TSDB_TIME_PRECISION_SECONDS
,
TSDB_TIME_PRECISION_MILLI
,
TSDB_TIME_PRECISION_MICRO
,
TSDB_TIME_PRECISION_NANO
};
TSDB_TIME_PRECISION_NANO
};
static
bool
smlParseBool
(
SSmlKv
*
kvVal
)
{
const
char
*
pVal
=
kvVal
->
value
;
int32_t
len
=
kvVal
->
length
;
if
((
len
==
1
)
&&
(
pVal
[
0
]
==
't'
||
pVal
[
0
]
==
'T'
))
{
kvVal
->
i
=
TSDB_TRUE
;
return
true
;
}
if
((
len
==
1
)
&&
(
pVal
[
0
]
==
'f'
||
pVal
[
0
]
==
'F'
))
{
kvVal
->
i
=
TSDB_FALSE
;
return
true
;
}
if
((
len
==
4
)
&&
!
strncasecmp
(
pVal
,
"true"
,
len
))
{
kvVal
->
i
=
TSDB_TRUE
;
return
true
;
}
if
((
len
==
5
)
&&
!
strncasecmp
(
pVal
,
"false"
,
len
))
{
kvVal
->
i
=
TSDB_FALSE
;
return
true
;
}
return
false
;
}
static
bool
smlIsBinary
(
const
char
*
pVal
,
uint16_t
len
)
{
// binary: "abc"
if
(
len
<
2
)
{
return
false
;
}
if
(
pVal
[
0
]
==
'"'
&&
pVal
[
len
-
1
]
==
'"'
)
{
return
true
;
}
return
false
;
}
static
bool
smlIsNchar
(
const
char
*
pVal
,
uint16_t
len
)
{
// nchar: L"abc"
if
(
len
<
3
)
{
return
false
;
}
if
(
pVal
[
1
]
==
'"'
&&
pVal
[
len
-
1
]
==
'"'
&&
(
pVal
[
0
]
==
'l'
||
pVal
[
0
]
==
'L'
))
{
return
true
;
}
return
false
;
}
static
int64_t
smlParseInfluxTime
(
SSmlHandle
*
info
,
const
char
*
data
,
int32_t
len
)
{
static
int64_t
smlParseInfluxTime
(
SSmlHandle
*
info
,
const
char
*
data
,
int32_t
len
)
{
uint8_t
toPrecision
=
info
->
currSTableMeta
?
info
->
currSTableMeta
->
tableInfo
.
precision
:
TSDB_TIME_PRECISION_NANO
;
uint8_t
toPrecision
=
info
->
currSTableMeta
?
info
->
currSTableMeta
->
tableInfo
.
precision
:
TSDB_TIME_PRECISION_NANO
;
...
@@ -189,6 +143,7 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd,
...
@@ -189,6 +143,7 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd,
int
cnt
=
0
;
int
cnt
=
0
;
SArray
*
preLineKV
=
info
->
preLineTagKV
;
SArray
*
preLineKV
=
info
->
preLineTagKV
;
SArray
*
maxKVs
=
info
->
maxTagKVs
;
bool
isSuperKVInit
=
true
;
bool
isSuperKVInit
=
true
;
SArray
*
superKV
=
NULL
;
SArray
*
superKV
=
NULL
;
if
(
info
->
dataFormat
){
if
(
info
->
dataFormat
){
...
@@ -212,12 +167,12 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd,
...
@@ -212,12 +167,12 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd,
if
(
unlikely
(
taosArrayGetSize
(
superKV
)
==
0
)){
if
(
unlikely
(
taosArrayGetSize
(
superKV
)
==
0
)){
isSuperKVInit
=
false
;
isSuperKVInit
=
false
;
}
}
taosArraySetSize
(
preLineKV
,
0
);
taosArraySetSize
(
maxKVs
,
0
);
}
}
}
else
{
}
else
{
taosArraySetSize
(
preLineKV
,
0
);
taosArraySetSize
(
maxKVs
,
0
);
}
}
taosArraySetSize
(
preLineKV
,
0
);
while
(
*
sql
<
sqlEnd
)
{
while
(
*
sql
<
sqlEnd
)
{
if
(
unlikely
(
IS_SPACE
(
*
sql
)))
{
if
(
unlikely
(
IS_SPACE
(
*
sql
)))
{
...
@@ -295,14 +250,14 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd,
...
@@ -295,14 +250,14 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd,
}
}
if
(
isSameMeasure
){
if
(
isSameMeasure
){
if
(
unlikely
(
cnt
>=
taosArrayGetSize
(
preLineKV
)))
{
if
(
unlikely
(
cnt
>=
taosArrayGetSize
(
maxKVs
)))
{
info
->
dataFormat
=
false
;
info
->
dataFormat
=
false
;
info
->
reRun
=
true
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
SSmlKv
*
preKV
=
(
SSmlKv
*
)
taosArrayGet
(
preLineKV
,
cnt
);
SSmlKv
*
maxKV
=
(
SSmlKv
*
)
taosArrayGet
(
maxKVs
,
cnt
);
if
(
unlikely
(
kv
.
length
>
pre
KV
->
length
)){
if
(
unlikely
(
kv
.
length
>
max
KV
->
length
)){
pre
KV
->
length
=
kv
.
length
;
max
KV
->
length
=
kv
.
length
;
SSmlSTableMeta
*
tableMeta
=
(
SSmlSTableMeta
*
)
nodeListGet
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
,
NULL
);
SSmlSTableMeta
*
tableMeta
=
(
SSmlSTableMeta
*
)
nodeListGet
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
,
NULL
);
ASSERT
(
tableMeta
!=
NULL
);
ASSERT
(
tableMeta
!=
NULL
);
...
@@ -322,11 +277,11 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd,
...
@@ -322,11 +277,11 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd,
info
->
reRun
=
true
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
SSmlKv
*
pre
KV
=
(
SSmlKv
*
)
taosArrayGet
(
superKV
,
cnt
);
SSmlKv
*
max
KV
=
(
SSmlKv
*
)
taosArrayGet
(
superKV
,
cnt
);
if
(
unlikely
(
kv
.
length
>
pre
KV
->
length
))
{
if
(
unlikely
(
kv
.
length
>
max
KV
->
length
))
{
pre
KV
->
length
=
kv
.
length
;
max
KV
->
length
=
kv
.
length
;
}
else
{
}
else
{
kv
.
length
=
pre
KV
->
length
;
kv
.
length
=
max
KV
->
length
;
}
}
info
->
needModifySchema
=
true
;
info
->
needModifySchema
=
true
;
...
@@ -338,11 +293,12 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd,
...
@@ -338,11 +293,12 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd,
}
else
{
}
else
{
taosArrayPush
(
superKV
,
&
kv
);
taosArrayPush
(
superKV
,
&
kv
);
}
}
taosArrayPush
(
preLineKV
,
&
kv
);
taosArrayPush
(
maxKVs
,
&
kv
);
}
}
}
else
{
}
else
{
taosArrayPush
(
preLineKV
,
&
kv
);
taosArrayPush
(
maxKVs
,
&
kv
);
}
}
taosArrayPush
(
preLineKV
,
&
kv
);
cnt
++
;
cnt
++
;
if
(
IS_SPACE
(
*
sql
)){
if
(
IS_SPACE
(
*
sql
)){
...
@@ -518,15 +474,15 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd,
...
@@ -518,15 +474,15 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd,
info
->
reRun
=
true
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
SSmlKv
*
pre
KV
=
(
SSmlKv
*
)
taosArrayGet
(
preLineKV
,
cnt
);
SSmlKv
*
max
KV
=
(
SSmlKv
*
)
taosArrayGet
(
preLineKV
,
cnt
);
if
(
kv
.
type
!=
pre
KV
->
type
){
if
(
kv
.
type
!=
max
KV
->
type
){
info
->
dataFormat
=
false
;
info
->
dataFormat
=
false
;
info
->
reRun
=
true
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
if
(
unlikely
(
IS_VAR_DATA_TYPE
(
kv
.
type
)
&&
kv
.
length
>
pre
KV
->
length
)){
if
(
unlikely
(
IS_VAR_DATA_TYPE
(
kv
.
type
)
&&
kv
.
length
>
max
KV
->
length
)){
pre
KV
->
length
=
kv
.
length
;
max
KV
->
length
=
kv
.
length
;
SSmlSTableMeta
*
tableMeta
=
(
SSmlSTableMeta
*
)
nodeListGet
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
,
NULL
);
SSmlSTableMeta
*
tableMeta
=
(
SSmlSTableMeta
*
)
nodeListGet
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
,
NULL
);
ASSERT
(
tableMeta
!=
NULL
);
ASSERT
(
tableMeta
!=
NULL
);
...
@@ -546,18 +502,18 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd,
...
@@ -546,18 +502,18 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd,
info
->
reRun
=
true
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
SSmlKv
*
pre
KV
=
(
SSmlKv
*
)
taosArrayGet
(
superKV
,
cnt
);
SSmlKv
*
max
KV
=
(
SSmlKv
*
)
taosArrayGet
(
superKV
,
cnt
);
if
(
unlikely
(
kv
.
type
!=
pre
KV
->
type
)){
if
(
unlikely
(
kv
.
type
!=
max
KV
->
type
)){
info
->
dataFormat
=
false
;
info
->
dataFormat
=
false
;
info
->
reRun
=
true
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
if
(
IS_VAR_DATA_TYPE
(
kv
.
type
)){
if
(
IS_VAR_DATA_TYPE
(
kv
.
type
)){
if
(
kv
.
length
>
pre
KV
->
length
)
{
if
(
kv
.
length
>
max
KV
->
length
)
{
pre
KV
->
length
=
kv
.
length
;
max
KV
->
length
=
kv
.
length
;
}
else
{
}
else
{
kv
.
length
=
pre
KV
->
length
;
kv
.
length
=
max
KV
->
length
;
}
}
info
->
needModifySchema
=
true
;
info
->
needModifySchema
=
true
;
}
}
...
...
source/client/src/clientSmlTelnet.c
浏览文件 @
dbd41bff
...
@@ -23,6 +23,11 @@
...
@@ -23,6 +23,11 @@
int32_t
is_same_child_table_telnet
(
const
void
*
a
,
const
void
*
b
){
int32_t
is_same_child_table_telnet
(
const
void
*
a
,
const
void
*
b
){
SSmlLineInfo
*
t1
=
(
SSmlLineInfo
*
)
a
;
SSmlLineInfo
*
t1
=
(
SSmlLineInfo
*
)
a
;
SSmlLineInfo
*
t2
=
(
SSmlLineInfo
*
)
b
;
SSmlLineInfo
*
t2
=
(
SSmlLineInfo
*
)
b
;
uError
(
"is_same_child_table_telnet len:%d,%d %s,%s @@@ len:%d,%d %s,%s"
,
t1
->
measureLen
,
t2
->
measureLen
,
t1
->
measure
,
t2
->
measure
,
t1
->
tagsLen
,
t2
->
tagsLen
,
t1
->
tags
,
t2
->
tags
);
if
(
t1
==
NULL
||
t2
==
NULL
||
t1
->
measure
==
NULL
||
t2
->
measure
==
NULL
||
t1
->
tags
==
NULL
||
t2
->
tags
==
NULL
)
return
1
;
return
(((
t1
->
measureLen
==
t2
->
measureLen
)
&&
memcmp
(
t1
->
measure
,
t2
->
measure
,
t1
->
measureLen
)
==
0
)
return
(((
t1
->
measureLen
==
t2
->
measureLen
)
&&
memcmp
(
t1
->
measure
,
t2
->
measure
,
t1
->
measureLen
)
==
0
)
&&
((
t1
->
tagsLen
==
t2
->
tagsLen
)
&&
memcmp
(
t1
->
tags
,
t2
->
tags
,
t1
->
tagsLen
)
==
0
))
?
0
:
1
;
&&
((
t1
->
tagsLen
==
t2
->
tagsLen
)
&&
memcmp
(
t1
->
tags
,
t2
->
tags
,
t1
->
tagsLen
)
==
0
))
?
0
:
1
;
}
}
...
@@ -73,6 +78,7 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
...
@@ -73,6 +78,7 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
int
cnt
=
0
;
int
cnt
=
0
;
SArray
*
preLineKV
=
info
->
preLineTagKV
;
SArray
*
preLineKV
=
info
->
preLineTagKV
;
SArray
*
maxKVs
=
info
->
maxTagKVs
;
bool
isSuperKVInit
=
true
;
bool
isSuperKVInit
=
true
;
SArray
*
superKV
=
NULL
;
SArray
*
superKV
=
NULL
;
if
(
info
->
dataFormat
){
if
(
info
->
dataFormat
){
...
@@ -96,12 +102,13 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
...
@@ -96,12 +102,13 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
if
(
unlikely
(
taosArrayGetSize
(
superKV
)
==
0
)){
if
(
unlikely
(
taosArrayGetSize
(
superKV
)
==
0
)){
isSuperKVInit
=
false
;
isSuperKVInit
=
false
;
}
}
taosArraySetSize
(
preLineKV
,
0
);
taosArraySetSize
(
maxKVs
,
0
);
}
}
}
else
{
}
else
{
taosArraySetSize
(
preLineKV
,
0
);
taosArraySetSize
(
maxKVs
,
0
);
}
}
taosArraySetSize
(
preLineKV
,
0
);
const
char
*
sql
=
data
;
const
char
*
sql
=
data
;
while
(
sql
<
sqlEnd
)
{
while
(
sql
<
sqlEnd
)
{
JUMP_SPACE
(
sql
,
sqlEnd
)
JUMP_SPACE
(
sql
,
sqlEnd
)
...
@@ -168,14 +175,14 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
...
@@ -168,14 +175,14 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
}
}
if
(
isSameMeasure
){
if
(
isSameMeasure
){
if
(
unlikely
(
cnt
>=
taosArrayGetSize
(
preLineKV
)))
{
if
(
unlikely
(
cnt
>=
taosArrayGetSize
(
maxKVs
)))
{
info
->
dataFormat
=
false
;
info
->
dataFormat
=
false
;
info
->
reRun
=
true
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
SSmlKv
*
preKV
=
(
SSmlKv
*
)
taosArrayGet
(
preLineKV
,
cnt
);
SSmlKv
*
maxKV
=
(
SSmlKv
*
)
taosArrayGet
(
maxKVs
,
cnt
);
if
(
unlikely
(
kv
.
length
>
pre
KV
->
length
)){
if
(
unlikely
(
kv
.
length
>
max
KV
->
length
)){
pre
KV
->
length
=
kv
.
length
;
max
KV
->
length
=
kv
.
length
;
SSmlSTableMeta
*
tableMeta
=
(
SSmlSTableMeta
*
)
nodeListGet
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
NULL
);
SSmlSTableMeta
*
tableMeta
=
(
SSmlSTableMeta
*
)
nodeListGet
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
NULL
);
ASSERT
(
tableMeta
!=
NULL
);
ASSERT
(
tableMeta
!=
NULL
);
...
@@ -195,11 +202,11 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
...
@@ -195,11 +202,11 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
info
->
reRun
=
true
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
SSmlKv
*
pre
KV
=
(
SSmlKv
*
)
taosArrayGet
(
superKV
,
cnt
);
SSmlKv
*
max
KV
=
(
SSmlKv
*
)
taosArrayGet
(
superKV
,
cnt
);
if
(
unlikely
(
kv
.
length
>
pre
KV
->
length
))
{
if
(
unlikely
(
kv
.
length
>
max
KV
->
length
))
{
pre
KV
->
length
=
kv
.
length
;
max
KV
->
length
=
kv
.
length
;
}
else
{
}
else
{
kv
.
length
=
pre
KV
->
length
;
kv
.
length
=
max
KV
->
length
;
}
}
info
->
needModifySchema
=
true
;
info
->
needModifySchema
=
true
;
...
@@ -211,11 +218,12 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
...
@@ -211,11 +218,12 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
}
else
{
}
else
{
taosArrayPush
(
superKV
,
&
kv
);
taosArrayPush
(
superKV
,
&
kv
);
}
}
taosArrayPush
(
preLineKV
,
&
kv
);
taosArrayPush
(
maxKVs
,
&
kv
);
}
}
}
else
{
}
else
{
taosArrayPush
(
preLineKV
,
&
kv
);
taosArrayPush
(
maxKVs
,
&
kv
);
}
}
taosArrayPush
(
preLineKV
,
&
kv
);
cnt
++
;
cnt
++
;
}
}
SSmlTableInfo
*
tinfo
=
(
SSmlTableInfo
*
)
nodeListGet
(
info
->
childTables
,
elements
,
POINTER_BYTES
,
is_same_child_table_telnet
);
SSmlTableInfo
*
tinfo
=
(
SSmlTableInfo
*
)
nodeListGet
(
info
->
childTables
,
elements
,
POINTER_BYTES
,
is_same_child_table_telnet
);
...
...
source/client/test/smlTest.cpp
浏览文件 @
dbd41bff
...
@@ -503,35 +503,35 @@ TEST(testCase, smlParseTelnetLine_Test) {
...
@@ -503,35 +503,35 @@ TEST(testCase, smlParseTelnetLine_Test) {
smlDestroyInfo
(
info
);
smlDestroyInfo
(
info
);
}
}
TEST
(
testCase
,
smlParseTelnetLine_diff_json_type2_Test
)
{
//
TEST(testCase, smlParseTelnetLine_diff_json_type2_Test) {
SSmlHandle
*
info
=
smlBuildSmlInfo
(
NULL
);
//
SSmlHandle *info = smlBuildSmlInfo(NULL);
info
->
protocol
=
TSDB_SML_JSON_PROTOCOL
;
//
info->protocol = TSDB_SML_JSON_PROTOCOL;
ASSERT_NE
(
info
,
nullptr
);
//
ASSERT_NE(info, nullptr);
//
const
char
*
sql
[]
=
{
//
const char *sql[] = {
"[{
\"
metric
\"
:
\"
sys.cpu.nice
\"
,
\"
timestamp
\"
: 1346846400,
\"
value
\"
: 18,
\"
tags
\"
: {
\"
host
\"
:
\"
lga
\"
}},{
\"
metric
\"
:
\"
sys.sdfa
\"
,
\"
timestamp
\"
: 1346846400,
\"
value
\"
:
\"
18
\"
,
\"
tags
\"
: {
\"
host
\"
: 8932}},]"
,
//
"[{\"metric\":\"sys.cpu.nice\",\"timestamp\": 1346846400,\"value\": 18,\"tags\": {\"host\": \"lga\"}},{\"metric\": \"sys.sdfa\",\"timestamp\": 1346846400,\"value\": \"18\",\"tags\": {\"host\": 8932}},]",
};
//
};
for
(
int
i
=
0
;
i
<
sizeof
(
sql
)
/
sizeof
(
sql
[
0
]);
i
++
)
{
//
for (int i = 0; i < sizeof(sql) / sizeof(sql[0]); i++) {
char
*
dataPointStart
=
(
char
*
)
sql
[
i
];
//
char *dataPointStart = (char *)sql[i];
int8_t
offset
[
4
]
=
{
0
};
//
int8_t offset[4] = {0};
while
(
1
)
{
//
while (1) {
SSmlLineInfo
elements
=
{
0
};
//
SSmlLineInfo elements = {0};
if
(
offset
[
0
]
==
0
){
//
if(offset[0] == 0){
smlJsonParseObjFirst
(
&
dataPointStart
,
&
elements
,
offset
);
//
smlJsonParseObjFirst(&dataPointStart, &elements, offset);
}
else
{
//
}else{
smlJsonParseObj
(
&
dataPointStart
,
&
elements
,
offset
);
//
smlJsonParseObj(&dataPointStart, &elements, offset);
}
//
}
if
(
*
dataPointStart
==
'\0'
)
break
;
//
if(*dataPointStart == '\0') break;
//
SArray
*
tags
=
smlJsonParseTags
(
elements
.
tags
,
elements
.
tags
+
elements
.
tagsLen
);
//
SArray *tags = smlJsonParseTags(elements.tags, elements.tags + elements.tagsLen);
size_t
num
=
taosArrayGetSize
(
tags
);
//
size_t num = taosArrayGetSize(tags);
ASSERT_EQ
(
num
,
1
);
//
ASSERT_EQ(num, 1);
//
taosArrayDestroy
(
tags
);
//
taosArrayDestroy(tags);
}
//
}
}
//
}
smlDestroyInfo
(
info
);
//
smlDestroyInfo(info);
}
//
}
TEST
(
testCase
,
smlParseNumber_performance_Test
)
{
TEST
(
testCase
,
smlParseNumber_performance_Test
)
{
char
msg
[
256
]
=
{
0
};
char
msg
[
256
]
=
{
0
};
...
...
tests/parallel_test/cases.task
浏览文件 @
dbd41bff
...
@@ -423,8 +423,8 @@
...
@@ -423,8 +423,8 @@
,,n,system-test,python3 ./test.py -f 0-others/compatibility.py
,,n,system-test,python3 ./test.py -f 0-others/compatibility.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_database.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_database.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py
,,
y
,system-test,./pytest.sh python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py
,,
n
,system-test,./pytest.sh python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py
,,
y
,system-test,./pytest.sh python3 ./test.py -f 1-insert/opentsdb_json_taosc_insert.py
,,
n
,system-test,./pytest.sh python3 ./test.py -f 1-insert/opentsdb_json_taosc_insert.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_stmt_muti_insert_query.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_stmt_muti_insert_query.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_stable.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_stable.py
...
@@ -1037,7 +1037,7 @@
...
@@ -1037,7 +1037,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-20582.py
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-20582.py
#develop test
#develop test
#
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/auto_create_table_json.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/auto_create_table_json.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/custom_col_tag.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/custom_col_tag.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/default_json.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/default_json.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/demo.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/demo.py
...
@@ -1046,7 +1046,7 @@
...
@@ -1046,7 +1046,7 @@
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/json_tag.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/json_tag.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/query_json.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/query_json.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sample_csv_json.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sample_csv_json.py
#
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sml_json_alltypes.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sml_json_alltypes.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/taosdemoTestQueryWithJson.py -R
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/taosdemoTestQueryWithJson.py -R
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/telnet_tcp.py -R
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/telnet_tcp.py -R
...
...
utils/test/c/sml_test.c
浏览文件 @
dbd41bff
...
@@ -78,21 +78,23 @@ int smlProcess_telnet_Test() {
...
@@ -78,21 +78,23 @@ int smlProcess_telnet_Test() {
pRes
=
taos_query
(
taos
,
"use sml_db"
);
pRes
=
taos_query
(
taos
,
"use sml_db"
);
taos_free_result
(
pRes
);
taos_free_result
(
pRes
);
char
*
sql
[
4
]
=
{
0
};
//
char *sql[4] = {0};
sql
[
0
]
=
taosMemoryCalloc
(
1
,
128
);
//
sql[0] = taosMemoryCalloc(1, 128);
sql
[
1
]
=
taosMemoryCalloc
(
1
,
128
);
//
sql[1] = taosMemoryCalloc(1, 128);
sql
[
2
]
=
taosMemoryCalloc
(
1
,
128
);
//
sql[2] = taosMemoryCalloc(1, 128);
sql
[
3
]
=
taosMemoryCalloc
(
1
,
128
);
//
sql[3] = taosMemoryCalloc(1, 128);
const
char
*
sql1
[]
=
{
"sys.if.bytes.out 1479496100 1.3E0 host=web01 interface=eth0"
,
const
char
*
sql1
[]
=
{
"sys.if.bytes.out 1479496100 1.3E0 host=web01 interface=eth0"
,
"sys.if.bytes.out 1479496101 1.3E1 interface=eth0 host=web01 "
,
"sys.if.bytes.out 1479496101 1.3E1 interface=eth0 host=web01 "
,
"sys.if.bytes.out 1479496102 1.3E3 network=tcp"
,
"sys.if.bytes.out 1479496102 1.3E3 network=tcp"
,
" sys.procs.running 1479496100 42 host=web01 "
};
" sys.procs.running 1479496100 42 host=web01 "
};
for
(
int
i
=
0
;
i
<
4
;
i
++
){
//
for(int i = 0; i < 4; i++){
strncpy
(
sql
[
i
],
sql1
[
i
],
128
);
//
strncpy(sql[i], sql1[i], 128);
}
//
}
pRes
=
taos_schemaless_insert
(
taos
,
(
char
**
)
sql
,
sizeof
(
sql
)
/
sizeof
(
sql
[
0
]),
TSDB_SML_TELNET_PROTOCOL
,
// pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_TELNET_PROTOCOL,
// TSDB_SML_TIMESTAMP_NANO_SECONDS);
pRes
=
taos_schemaless_insert
(
taos
,
(
char
**
)
sql1
,
sizeof
(
sql1
)
/
sizeof
(
sql1
[
0
]),
TSDB_SML_TELNET_PROTOCOL
,
TSDB_SML_TIMESTAMP_NANO_SECONDS
);
TSDB_SML_TIMESTAMP_NANO_SECONDS
);
printf
(
"%s result:%s
\n
"
,
__FUNCTION__
,
taos_errstr
(
pRes
));
printf
(
"%s result:%s
\n
"
,
__FUNCTION__
,
taos_errstr
(
pRes
));
int
code
=
taos_errno
(
pRes
);
int
code
=
taos_errno
(
pRes
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录