Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
194a1081
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看板
提交
194a1081
编写于
10月 15, 2021
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-10639]<fix>: allow influxDB line protocol column value contain space/comma inside double quote
上级
befffdf7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
45 addition
and
10 deletion
+45
-10
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+43
-8
tests/pytest/insert/line_insert.py
tests/pytest/insert/line_insert.py
+2
-2
未找到文件。
src/client/src/tscParseLineProtocol.c
浏览文件 @
194a1081
...
...
@@ -1871,7 +1871,7 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
//key field cannot start with digit
if
(
isdigit
(
*
cur
))
{
tscError
(
"SML:0x%"
PRIx64
" Tag key cann
n
ot start with digit"
,
info
->
id
);
tscError
(
"SML:0x%"
PRIx64
" Tag key cannot start with digit"
,
info
->
id
);
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
}
while
(
*
cur
!=
'\0'
)
{
...
...
@@ -1885,6 +1885,8 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
}
//Escape special character
if
(
*
cur
==
'\\'
)
{
//TODO: escape will work after column & tag
//support spcial characters
escapeSpecialCharacter
(
2
,
&
cur
);
}
key
[
len
]
=
*
cur
;
...
...
@@ -1908,13 +1910,42 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
static
bool
parseSmlValue
(
TAOS_SML_KV
*
pKV
,
const
char
**
index
,
bool
*
is_last_kv
,
SSmlLinesInfo
*
info
,
bool
isTag
)
{
const
char
*
start
,
*
cur
;
int32_t
ret
=
TSDB_CODE_SUCCESS
;
char
*
value
=
NULL
;
uint16_t
len
=
0
;
bool
searchQuote
=
false
;
start
=
cur
=
*
index
;
//if field value is string
if
(
!
isTag
)
{
if
(
*
cur
==
'"'
)
{
searchQuote
=
true
;
cur
+=
1
;
len
+=
1
;
}
else
if
(
*
cur
==
'L'
&&
*
(
cur
+
1
)
==
'"'
)
{
searchQuote
=
true
;
cur
+=
2
;
len
+=
2
;
}
}
while
(
1
)
{
// unescaped ',' or ' ' or '\0' identifies a value
if
((
*
cur
==
','
||
*
cur
==
' '
||
*
cur
==
'\0'
)
&&
*
(
cur
-
1
)
!=
'\\'
)
{
if
(((
*
cur
==
','
||
*
cur
==
' '
)
&&
*
(
cur
-
1
)
!=
'\\'
)
||
*
cur
==
'\0'
)
{
if
(
searchQuote
==
true
)
{
//first quote ignored while searching
if
(
*
(
cur
-
1
)
==
'"'
&&
len
!=
1
&&
len
!=
2
)
{
*
is_last_kv
=
(
*
cur
==
' '
||
*
cur
==
'\0'
)
?
true
:
false
;
break
;
}
else
if
(
*
cur
==
'\0'
)
{
ret
=
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
goto
error
;
}
else
{
cur
++
;
len
++
;
continue
;
}
}
//unescaped ' ' or '\0' indicates end of value
*
is_last_kv
=
(
*
cur
==
' '
||
*
cur
==
'\0'
)
?
true
:
false
;
if
(
*
cur
==
' '
&&
*
(
cur
+
1
)
==
' '
)
{
...
...
@@ -1926,7 +1957,7 @@ static bool parseSmlValue(TAOS_SML_KV *pKV, const char **index,
}
//Escape special character
if
(
*
cur
==
'\\'
)
{
escapeSpecialCharacter
(
2
,
&
cur
);
escapeSpecialCharacter
(
isTag
?
2
:
3
,
&
cur
);
}
cur
++
;
len
++
;
...
...
@@ -1938,16 +1969,20 @@ static bool parseSmlValue(TAOS_SML_KV *pKV, const char **index,
if
(
!
convertSmlValueType
(
pKV
,
value
,
len
,
info
,
isTag
))
{
tscError
(
"SML:0x%"
PRIx64
" Failed to convert sml value string(%s) to any type"
,
info
->
id
,
value
);
//free previous alocated key field
free
(
pKV
->
key
);
pKV
->
key
=
NULL
;
free
(
value
);
return
TSDB_CODE_TSC_INVALID_VALUE
;
ret
=
TSDB_CODE_TSC_INVALID_VALUE
;
goto
error
;
}
free
(
value
);
*
index
=
(
*
cur
==
'\0'
)
?
cur
:
cur
+
1
;
return
TSDB_CODE_SUCCESS
;
return
ret
;
error:
//free previous alocated key field
free
(
pKV
->
key
);
pKV
->
key
=
NULL
;
return
ret
;
}
static
int32_t
parseSmlMeasurement
(
TAOS_SML_DATA_POINT
*
pSml
,
const
char
**
index
,
...
...
tests/pytest/insert/line_insert.py
浏览文件 @
194a1081
...
...
@@ -31,9 +31,9 @@ class TDTestCase:
tdSql
.
execute
(
'create stable ste(ts timestamp, f int) tags(t1 bigint)'
)
lines
=
[
"st,t1=3i64,t2=4f64,t3=
\"
t3
\"
c1=3i64,c3=L
\"
passit
\"
,c2=false,c4=4f64 1626006833639000000"
,
lines
=
[
"st,t1=3i64,t2=4f64,t3=
\"
t3
\"
c1=3i64,c3=L
\"
\"\"
a pa,
\"
s si,t
\"\"
\"
,c2=false,c4=4f64 1626006833639000000"
,
"st,t1=4i64,t3=
\"
t4
\"
,t2=5f64,t4=5f64 c1=3i64,c3=L
\"
passitagin
\"
,c2=true,c4=5f64,c5=5f64 1626006833640000000"
,
"ste,t2=5f64,t3=L
\"
ste
\"
c1=true,c2=4i64,c3=
\"
iam
\"
1626056811823316532"
,
"ste,t2=5f64,t3=L
\"
ste
\"
c1=true,c2=4i64,c3=
\"
i,
\"
a
\"
m,
\"\"
\"
1626056811823316532"
,
"stf,t1=4i64,t3=
\"
t4
\"
,t2=5f64,t4=5f64 c1=3i64,c3=L
\"
passitagin
\"
,c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000"
,
"st,t1=4i64,t2=5f64,t3=
\"
t4
\"
c1=3i64,c3=L
\"
passitagain
\"
,c2=true,c4=5f64 1626006833642000000"
,
"ste,t2=5f64,t3=L
\"
ste2
\"
c3=
\"
iamszhou
\"
,c4=false 1626056811843316532"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录