Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
05e5beb8
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看板
未验证
提交
05e5beb8
编写于
7月 18, 2022
作者:
wmmhello
提交者:
GitHub
7月 18, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14970 from taosdata/feature/TD-14761
fix:raw block datalen if json data
上级
62755537
22903b3d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
41 addition
and
1 deletion
+41
-1
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+10
-0
source/client/src/clientSml.c
source/client/src/clientSml.c
+5
-1
source/client/test/smlTest.cpp
source/client/test/smlTest.cpp
+26
-0
未找到文件。
source/client/src/clientImpl.c
浏览文件 @
05e5beb8
...
...
@@ -1609,11 +1609,13 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
if
(
pResultInfo
->
convertJson
==
NULL
)
return
TSDB_CODE_OUT_OF_MEMORY
;
char
*
p1
=
pResultInfo
->
convertJson
;
int32_t
totalLen
=
0
;
int32_t
len
=
sizeof
(
int32_t
)
+
sizeof
(
uint64_t
)
+
numOfCols
*
(
sizeof
(
int16_t
)
+
sizeof
(
int32_t
));
memcpy
(
p1
,
p
,
len
);
p
+=
len
;
p1
+=
len
;
totalLen
+=
len
;
len
=
sizeof
(
int32_t
)
*
numOfCols
;
int32_t
*
colLength
=
(
int32_t
*
)
p
;
...
...
@@ -1621,6 +1623,7 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
memcpy
(
p1
,
p
,
len
);
p
+=
len
;
p1
+=
len
;
totalLen
+=
len
;
char
*
pStart
=
p
;
char
*
pStart1
=
p1
;
...
...
@@ -1636,6 +1639,7 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
memcpy
(
pStart1
,
pStart
,
len
);
pStart
+=
len
;
pStart1
+=
len
;
totalLen
+=
len
;
len
=
0
;
for
(
int32_t
j
=
0
;
j
<
numOfRows
;
++
j
)
{
...
...
@@ -1680,24 +1684,30 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
len
+=
varDataTLen
(
dst
);
}
colLen1
=
len
;
totalLen
+=
colLen1
;
colLength1
[
i
]
=
htonl
(
len
);
}
else
if
(
IS_VAR_DATA_TYPE
(
pResultInfo
->
fields
[
i
].
type
))
{
len
=
numOfRows
*
sizeof
(
int32_t
);
memcpy
(
pStart1
,
pStart
,
len
);
pStart
+=
len
;
pStart1
+=
len
;
totalLen
+=
len
;
totalLen
+=
colLen
;
memcpy
(
pStart1
,
pStart
,
colLen
);
}
else
{
len
=
BitmapLen
(
pResultInfo
->
numOfRows
);
memcpy
(
pStart1
,
pStart
,
len
);
pStart
+=
len
;
pStart1
+=
len
;
totalLen
+=
len
;
totalLen
+=
colLen
;
memcpy
(
pStart1
,
pStart
,
colLen
);
}
pStart
+=
colLen
;
pStart1
+=
colLen1
;
}
*
(
int32_t
*
)(
pResultInfo
->
convertJson
)
=
totalLen
;
pResultInfo
->
pData
=
pResultInfo
->
convertJson
;
return
TSDB_CODE_SUCCESS
;
}
...
...
source/client/src/clientSml.c
浏览文件 @
05e5beb8
...
...
@@ -609,7 +609,7 @@ static bool smlParseNumber(SSmlKv *kvVal, SSmlMsgBuf *msg) {
}
kvVal
->
type
=
TSDB_DATA_TYPE_BIGINT
;
kvVal
->
i
=
(
int64_t
)
result
;
}
else
if
((
left
==
3
&&
strncasecmp
(
endptr
,
"u64"
,
left
)
==
0
))
{
}
else
if
((
left
==
1
&&
*
endptr
==
'u'
)
||
(
left
==
3
&&
strncasecmp
(
endptr
,
"u64"
,
left
)
==
0
))
{
if
(
result
>=
(
double
)
UINT64_MAX
||
result
<
0
)
{
errno
=
0
;
uint64_t
tmp
=
taosStr2UInt64
(
pVal
,
&
endptr
,
10
);
...
...
@@ -1047,6 +1047,10 @@ static int32_t smlParseTelnetTags(const char *data, SArray *cols, char *childTab
continue
;
}
if
(
valueLen
>
(
TSDB_MAX_NCHAR_LEN
-
VARSTR_HEADER_SIZE
)
/
TSDB_NCHAR_SIZE
){
return
TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN
;
}
// add kv to SSmlKv
SSmlKv
*
kv
=
(
SSmlKv
*
)
taosMemoryCalloc
(
sizeof
(
SSmlKv
),
1
);
if
(
!
kv
)
return
TSDB_CODE_OUT_OF_MEMORY
;
...
...
source/client/test/smlTest.cpp
浏览文件 @
05e5beb8
...
...
@@ -499,6 +499,32 @@ TEST(testCase, smlGetTimestampLen_Test) {
ASSERT_EQ
(
len
,
3
);
}
TEST
(
testCase
,
smlParseNumber_Test
)
{
SSmlKv
kv
=
{
0
};
char
buf
[
64
]
=
{
0
};
SSmlMsgBuf
msg
=
{
0
};
msg
.
buf
=
buf
;
msg
.
len
=
64
;
kv
.
value
=
"3.2e-900"
;
kv
.
length
=
8
;
bool
res
=
smlParseNumber
(
&
kv
,
&
msg
);
printf
(
"res:%d,v:%f, %f
\n
"
,
res
,
kv
.
d
,
HUGE_VAL
);
}
//#include <stdlib.h>
//TEST(testCase, number_Test) {
// char *str[] = {
//// "-000 0999",
// "- abc",
// };
// for(int i = 0; i < sizeof(str)/sizeof(str[0]); i++){
// errno = 0;
// char *end = NULL;
// long result = strtol(str[i], &end, 10);
// printf("errno:%d,len:%d,result:%ld\n", errno, end - str[i], result);
// }
//
//}
/*
TEST(testCase, smlProcess_influx_Test) {
TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录