Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7630c9ae
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看板
提交
7630c9ae
编写于
7月 16, 2021
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support default as float
上级
351757c7
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
19 addition
and
9 deletion
+19
-9
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+19
-9
未找到文件。
src/client/src/tscParseLineProtocol.c
浏览文件 @
7630c9ae
...
@@ -1185,13 +1185,13 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
...
@@ -1185,13 +1185,13 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
if
(
len
<=
0
)
{
if
(
len
<=
0
)
{
return
false
;
return
false
;
}
}
//integer number
//integer number
if
(
isTinyInt
(
value
,
len
))
{
if
(
isTinyInt
(
value
,
len
))
{
pVal
->
type
=
TSDB_DATA_TYPE_TINYINT
;
pVal
->
type
=
TSDB_DATA_TYPE_TINYINT
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
value
[
len
-
2
]
=
'\0'
;
value
[
len
-
2
]
=
'\0'
;
if
(
!
isValidInteger
(
value
))
{
if
(
!
isValidInteger
(
value
))
{
return
false
;
}
}
pVal
->
value
=
calloc
(
pVal
->
length
,
1
);
pVal
->
value
=
calloc
(
pVal
->
length
,
1
);
int8_t
val
=
(
int8_t
)
strtoll
(
value
,
NULL
,
10
);
int8_t
val
=
(
int8_t
)
strtoll
(
value
,
NULL
,
10
);
...
@@ -1335,7 +1335,17 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
...
@@ -1335,7 +1335,17 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
memcpy
(
pVal
->
value
,
&
bVal
,
pVal
->
length
);
memcpy
(
pVal
->
value
,
&
bVal
,
pVal
->
length
);
return
true
;
return
true
;
}
}
//TODO: handle default is float here
//Handle default(no appendix) as float
if
(
isValidInteger
(
value
)
||
isValidFloat
(
value
))
{
printf
(
"Gavin Default as float
\n
"
);
pVal
->
type
=
TSDB_DATA_TYPE_FLOAT
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
value
=
calloc
(
pVal
->
length
,
1
);
float
val
=
(
float
)
strtold
(
value
,
NULL
);
memcpy
(
pVal
->
value
,
&
val
,
pVal
->
length
);
printf
(
"value:%02x %02x %02x %02x
\n
"
,
pVal
->
value
[
0
]
&
0xff
,
pVal
->
value
[
1
]
&
0xff
,
pVal
->
value
[
2
]
&
0xff
,
pVal
->
value
[
3
]
&
0xff
);
return
true
;
}
return
false
;
return
false
;
}
}
...
@@ -1464,9 +1474,9 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index) {
...
@@ -1464,9 +1474,9 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index) {
char
key
[
TSDB_COL_NAME_LEN
];
char
key
[
TSDB_COL_NAME_LEN
];
uint16_t
len
=
0
;
uint16_t
len
=
0
;
//key field cannot start with
'_'
//key field cannot start with
digit
if
(
*
cur
==
'_'
)
{
if
(
isdigit
(
*
cur
)
)
{
//printf("Tag key cannnot start with \'_\'
\n");
tscError
(
"Tag key cannnot start with digit
\n
"
);
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
}
}
while
(
*
cur
!=
'\0'
)
{
while
(
*
cur
!=
'\0'
)
{
...
@@ -1490,7 +1500,7 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index) {
...
@@ -1490,7 +1500,7 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index) {
pKV
->
key
=
calloc
(
len
+
1
,
1
);
pKV
->
key
=
calloc
(
len
+
1
,
1
);
memcpy
(
pKV
->
key
,
key
,
len
+
1
);
memcpy
(
pKV
->
key
,
key
,
len
+
1
);
tscDebug
(
"Key:%s|len:%d"
,
pKV
->
key
,
len
);
//
tscDebug("Key:%s|len:%d", pKV->key, len);
*
index
=
cur
+
1
;
*
index
=
cur
+
1
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -1539,8 +1549,8 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index
...
@@ -1539,8 +1549,8 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index
uint16_t
len
=
0
;
uint16_t
len
=
0
;
pSml
->
stableName
=
calloc
(
TSDB_TABLE_NAME_LEN
,
1
);
pSml
->
stableName
=
calloc
(
TSDB_TABLE_NAME_LEN
,
1
);
if
(
*
cur
==
'_'
)
{
if
(
isdigit
(
*
cur
)
)
{
tscError
(
"Measurement field cannnot start with
\'
_
\'
"
);
tscError
(
"Measurement field cannnot start with
digit
"
);
free
(
pSml
->
stableName
);
free
(
pSml
->
stableName
);
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
}
}
...
@@ -1607,7 +1617,7 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs,
...
@@ -1607,7 +1617,7 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs,
*
num_kvs
+=
1
;
*
num_kvs
+=
1
;
if
(
is_last_kv
)
{
if
(
is_last_kv
)
{
tscDebug
(
"last key-value field detected"
);
//
tscDebug("last key-value field detected");
goto
done
;
goto
done
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录