Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
04f1f710
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看板
提交
04f1f710
编写于
6月 09, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:error in schemaless
上级
0147e498
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
39 addition
and
2 deletion
+39
-2
source/client/src/clientSml.c
source/client/src/clientSml.c
+5
-2
source/client/test/smlTest.cpp
source/client/test/smlTest.cpp
+34
-0
未找到文件。
source/client/src/clientSml.c
浏览文件 @
04f1f710
...
...
@@ -1548,7 +1548,7 @@ static int32_t smlParseTSFromJSONObj(SSmlHandle *info, cJSON *root, int64_t *tsV
}
size_t
typeLen
=
strlen
(
type
->
valuestring
);
if
(
typeLen
==
1
&&
type
->
valuestring
[
0
]
==
's'
)
{
if
(
typeLen
==
1
&&
(
type
->
valuestring
[
0
]
==
's'
||
type
->
valuestring
[
0
]
==
'S'
)
)
{
//seconds
timeDouble
=
timeDouble
*
1e9
;
if
(
smlDoubleToInt64OverFlow
(
timeDouble
)){
...
...
@@ -1556,9 +1556,10 @@ static int32_t smlParseTSFromJSONObj(SSmlHandle *info, cJSON *root, int64_t *tsV
return
TSDB_CODE_TSC_INVALID_TIME_STAMP
;
}
*
tsVal
=
timeDouble
;
}
else
if
(
typeLen
==
2
&&
type
->
valuestring
[
1
]
==
's'
)
{
}
else
if
(
typeLen
==
2
&&
(
type
->
valuestring
[
0
]
==
's'
||
type
->
valuestring
[
0
]
==
'S'
)
)
{
switch
(
type
->
valuestring
[
0
])
{
case
'm'
:
case
'M'
:
//milliseconds
timeDouble
=
timeDouble
*
1e6
;
if
(
smlDoubleToInt64OverFlow
(
timeDouble
)){
...
...
@@ -1568,6 +1569,7 @@ static int32_t smlParseTSFromJSONObj(SSmlHandle *info, cJSON *root, int64_t *tsV
*
tsVal
=
timeDouble
;
break
;
case
'u'
:
case
'U'
:
//microseconds
timeDouble
=
timeDouble
*
1e3
;
if
(
smlDoubleToInt64OverFlow
(
timeDouble
)){
...
...
@@ -1577,6 +1579,7 @@ static int32_t smlParseTSFromJSONObj(SSmlHandle *info, cJSON *root, int64_t *tsV
*
tsVal
=
timeDouble
;
break
;
case
'n'
:
case
'N'
:
//nanoseconds
*
tsVal
=
timeDouble
;
break
;
...
...
source/client/test/smlTest.cpp
浏览文件 @
04f1f710
...
...
@@ -1329,3 +1329,37 @@ TEST(testCase, sml_oom_Test) {
ASSERT_EQ
(
taos_errno
(
res
),
0
);
taos_free_result
(
pRes
);
}
TEST
(
testCase
,
sml_16368_Test
)
{
TAOS
*
taos
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
ASSERT_NE
(
taos
,
nullptr
);
TAOS_RES
*
pRes
=
taos_query
(
taos
,
"create database if not exists d16368 schemaless 1"
);
taos_free_result
(
pRes
);
pRes
=
taos_query
(
taos
,
"use d16368"
);
taos_free_result
(
pRes
);
SRequestObj
*
request
=
(
SRequestObj
*
)
createRequest
((
STscObj
*
)
taos
,
NULL
,
TSDB_SQL_INSERT
);
ASSERT_NE
(
request
,
nullptr
);
SSmlHandle
*
info
=
smlBuildSmlInfo
(
taos
,
request
,
TSDB_SML_JSON_PROTOCOL
,
TSDB_SML_TIMESTAMP_NANO_SECONDS
);
ASSERT_NE
(
info
,
nullptr
);
const
char
*
sql
[]
=
{
"[{
\"
metric
\"
:
\"
st123456
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006833639000,
\"
type
\"
:
\"
us
\"
},
\"
value
\"
: 1,
\"
tags
\"
: {
\"
t1
\"
: 3,
\"
t2
\"
: {
\"
value
\"
: 4,
\"
type
\"
:
\"
double
\"
},
\"
t3
\"
: {
\"
value
\"
:
\"
t3
\"
,
\"
type
\"
:
\"
binary
\"
}}},
\n
"
"{
\"
metric
\"
:
\"
st123456
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006833739000,
\"
type
\"
:
\"
us
\"
},
\"
value
\"
: 2,
\"
tags
\"
: {
\"
t1
\"
: {
\"
value
\"
: 4,
\"
type
\"
:
\"
double
\"
},
\"
t3
\"
: {
\"
value
\"
:
\"
t4
\"
,
\"
type
\"
:
\"
binary
\"
},
\"
t2
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
},
\"
t4
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
}}},
\n
"
"{
\"
metric
\"
:
\"
stb_name
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006833639100,
\"
type
\"
:
\"
us
\"
},
\"
value
\"
: 3,
\"
tags
\"
: {
\"
t2
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
},
\"
t3
\"
: {
\"
value
\"
:
\"
ste
\"
,
\"
type
\"
:
\"
nchar
\"
}}},
\n
"
"{
\"
metric
\"
:
\"
stf567890
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006833639200,
\"
type
\"
:
\"
us
\"
},
\"
value
\"
: 4,
\"
tags
\"
: {
\"
t1
\"
: {
\"
value
\"
: 4,
\"
type
\"
:
\"
bigint
\"
},
\"
t3
\"
: {
\"
value
\"
:
\"
t4
\"
,
\"
type
\"
:
\"
binary
\"
},
\"
t2
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
},
\"
t4
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
}}},
\n
"
"{
\"
metric
\"
:
\"
st123456
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006833639300,
\"
type
\"
:
\"
us
\"
},
\"
value
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
},
\"
tags
\"
: {
\"
t1
\"
: {
\"
value
\"
: 4,
\"
type
\"
:
\"
double
\"
},
\"
t2
\"
: 5.0,
\"
t3
\"
: {
\"
value
\"
:
\"
t4
\"
,
\"
type
\"
:
\"
binary
\"
}}},
\n
"
"{
\"
metric
\"
:
\"
stb_name
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006833639400,
\"
type
\"
:
\"
us
\"
},
\"
value
\"
: {
\"
value
\"
: 6,
\"
type
\"
:
\"
double
\"
},
\"
tags
\"
: {
\"
t2
\"
: 5.0,
\"
t3
\"
: {
\"
value
\"
:
\"
ste2
\"
,
\"
type
\"
:
\"
nchar
\"
}}},
\n
"
"{
\"
metric
\"
:
\"
stb_name
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006834639400,
\"
type
\"
:
\"
us
\"
},
\"
value
\"
: {
\"
value
\"
: 7,
\"
type
\"
:
\"
double
\"
},
\"
tags
\"
: {
\"
t2
\"
: {
\"
value
\"
: 5.0,
\"
type
\"
:
\"
double
\"
},
\"
t3
\"
: {
\"
value
\"
:
\"
ste2
\"
,
\"
type
\"
:
\"
nchar
\"
}}},
\n
"
"{
\"
metric
\"
:
\"
st123456
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006833839006,
\"
type
\"
:
\"
us
\"
},
\"
value
\"
: {
\"
value
\"
: 8,
\"
type
\"
:
\"
double
\"
},
\"
tags
\"
: {
\"
t1
\"
: {
\"
value
\"
: 4,
\"
type
\"
:
\"
double
\"
},
\"
t3
\"
: {
\"
value
\"
:
\"
t4
\"
,
\"
type
\"
:
\"
binary
\"
},
\"
t2
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
},
\"
t4
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
}}},
\n
"
"{
\"
metric
\"
:
\"
st123456
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006833939007,
\"
type
\"
:
\"
us
\"
},
\"
value
\"
: {
\"
value
\"
: 9,
\"
type
\"
:
\"
double
\"
},
\"
tags
\"
: {
\"
t1
\"
: 4,
\"
t3
\"
: {
\"
value
\"
:
\"
t4
\"
,
\"
type
\"
:
\"
binary
\"
},
\"
t2
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
},
\"
t4
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
}}}]"
};
int32_t
ret
=
smlProcess
(
info
,
(
char
**
)
sql
,
sizeof
(
sql
)
/
sizeof
(
sql
[
0
]));
ASSERT_EQ
(
ret
,
0
);
destroyRequest
(
request
);
smlDestroyInfo
(
info
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录