Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2714db10
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2714db10
编写于
7月 24, 2023
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:modify dot to underline in schemaless supertable name
上级
d7bb7e11
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
67 addition
and
7 deletion
+67
-7
source/client/inc/clientSml.h
source/client/inc/clientSml.h
+1
-0
source/client/src/clientSml.c
source/client/src/clientSml.c
+22
-7
source/client/src/clientSmlLine.c
source/client/src/clientSmlLine.c
+2
-0
tests/system-test/2-query/sml.py
tests/system-test/2-query/sml.py
+9
-0
utils/test/c/sml_test.c
utils/test/c/sml_test.c
+33
-0
未找到文件。
source/client/inc/clientSml.h
浏览文件 @
2714db10
...
...
@@ -258,6 +258,7 @@ int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine
int32_t
smlParseTelnetString
(
SSmlHandle
*
info
,
char
*
sql
,
char
*
sqlEnd
,
SSmlLineInfo
*
elements
);
int32_t
smlParseJSON
(
SSmlHandle
*
info
,
char
*
payload
);
void
smlStrReplace
(
char
*
src
,
int32_t
len
);
#ifdef __cplusplus
}
#endif
...
...
source/client/src/clientSml.c
浏览文件 @
2714db10
...
...
@@ -114,6 +114,14 @@ inline bool smlDoubleToInt64OverFlow(double num) {
return
false
;
}
void
smlStrReplace
(
char
*
src
,
int32_t
len
){
for
(
int
i
=
0
;
i
<
len
;
i
++
){
if
(
src
[
i
]
==
'.'
){
src
[
i
]
=
'_'
;
}
}
}
int32_t
smlBuildInvalidDataMsg
(
SSmlMsgBuf
*
pBuf
,
const
char
*
msg1
,
const
char
*
msg2
)
{
if
(
pBuf
->
buf
)
{
memset
(
pBuf
->
buf
,
0
,
pBuf
->
len
);
...
...
@@ -838,6 +846,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
char
*
measure
=
taosMemoryMalloc
(
superTableLen
);
memcpy
(
measure
,
superTable
,
superTableLen
);
PROCESS_SLASH_IN_MEASUREMENT
(
measure
,
superTableLen
);
smlStrReplace
(
measure
,
superTableLen
);
memset
(
pName
.
tname
,
0
,
TSDB_TABLE_NAME_LEN
);
memcpy
(
pName
.
tname
,
measure
,
superTableLen
);
taosMemoryFree
(
measure
);
...
...
@@ -1051,7 +1060,8 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
taosMemoryFreeClear
(
sTableData
->
tableMeta
);
sTableData
->
tableMeta
=
pTableMeta
;
uDebug
(
"SML:0x%"
PRIx64
"modify schema uid:%"
PRIu64
", sversion:%d, tversion:%d"
,
info
->
id
,
pTableMeta
->
uid
,
pTableMeta
->
sversion
,
pTableMeta
->
tversion
)
tmp
=
(
SSmlSTableMeta
**
)
taosHashIterate
(
info
->
superTables
,
tmp
);
pTableMeta
->
sversion
,
pTableMeta
->
tversion
);
tmp
=
(
SSmlSTableMeta
**
)
taosHashIterate
(
info
->
superTables
,
tmp
);
}
uDebug
(
"SML:0x%"
PRIx64
" smlModifyDBSchemas end success, format:%d, needModifySchema:%d"
,
info
->
id
,
info
->
dataFormat
,
info
->
needModifySchema
);
...
...
@@ -1394,7 +1404,14 @@ static int32_t smlInsertData(SSmlHandle *info) {
SSmlTableInfo
**
oneTable
=
(
SSmlTableInfo
**
)
taosHashIterate
(
info
->
childTables
,
NULL
);
while
(
oneTable
)
{
SSmlTableInfo
*
tableData
=
*
oneTable
;
tstrncpy
(
pName
.
tname
,
tableData
->
sTableName
,
tableData
->
sTableNameLen
+
1
);
int
measureLen
=
tableData
->
sTableNameLen
;
char
*
measure
=
(
char
*
)
taosMemoryMalloc
(
tableData
->
sTableNameLen
);
memcpy
(
measure
,
tableData
->
sTableName
,
tableData
->
sTableNameLen
);
PROCESS_SLASH_IN_MEASUREMENT
(
measure
,
measureLen
);
smlStrReplace
(
measure
,
measureLen
);
tstrncpy
(
pName
.
tname
,
measure
,
measureLen
+
1
);
if
(
info
->
pRequest
->
tableList
==
NULL
)
{
info
->
pRequest
->
tableList
=
taosArrayInit
(
1
,
sizeof
(
SName
));
...
...
@@ -1411,6 +1428,7 @@ static int32_t smlInsertData(SSmlHandle *info) {
code
=
smlCheckAuth
(
info
,
&
conn
,
pName
.
tname
,
AUTH_TYPE_WRITE
);
if
(
code
!=
TSDB_CODE_SUCCESS
){
taosMemoryFree
(
measure
);
return
code
;
}
...
...
@@ -1418,6 +1436,7 @@ static int32_t smlInsertData(SSmlHandle *info) {
code
=
catalogGetTableHashVgroup
(
info
->
pCatalog
,
&
conn
,
&
pName
,
&
vg
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
uError
(
"SML:0x%"
PRIx64
" catalogGetTableHashVgroup failed. table name: %s"
,
info
->
id
,
tableData
->
childTableName
);
taosMemoryFree
(
measure
);
return
code
;
}
taosHashPut
(
info
->
pVgHash
,
(
const
char
*
)
&
vg
.
vgId
,
sizeof
(
vg
.
vgId
),
(
char
*
)
&
vg
,
sizeof
(
vg
));
...
...
@@ -1426,6 +1445,7 @@ static int32_t smlInsertData(SSmlHandle *info) {
(
SSmlSTableMeta
**
)
taosHashGet
(
info
->
superTables
,
tableData
->
sTableName
,
tableData
->
sTableNameLen
);
if
(
unlikely
(
NULL
==
pMeta
||
NULL
==
(
*
pMeta
)
->
tableMeta
))
{
uError
(
"SML:0x%"
PRIx64
" NULL == pMeta. table name: %s"
,
info
->
id
,
tableData
->
childTableName
);
taosMemoryFree
(
measure
);
return
TSDB_CODE_SML_INTERNAL_ERROR
;
}
...
...
@@ -1435,11 +1455,6 @@ static int32_t smlInsertData(SSmlHandle *info) {
uDebug
(
"SML:0x%"
PRIx64
" smlInsertData table:%s, uid:%"
PRIu64
", format:%d"
,
info
->
id
,
pName
.
tname
,
tableData
->
uid
,
info
->
dataFormat
);
int
measureLen
=
tableData
->
sTableNameLen
;
char
*
measure
=
(
char
*
)
taosMemoryMalloc
(
tableData
->
sTableNameLen
);
memcpy
(
measure
,
tableData
->
sTableName
,
tableData
->
sTableNameLen
);
PROCESS_SLASH_IN_MEASUREMENT
(
measure
,
measureLen
);
code
=
smlBindData
(
info
->
pQuery
,
info
->
dataFormat
,
tableData
->
tags
,
(
*
pMeta
)
->
cols
,
tableData
->
cols
,
(
*
pMeta
)
->
tableMeta
,
tableData
->
childTableName
,
measure
,
measureLen
,
info
->
ttl
,
info
->
msgBuf
.
buf
,
info
->
msgBuf
.
len
);
...
...
source/client/src/clientSmlLine.c
浏览文件 @
2714db10
...
...
@@ -157,6 +157,7 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
measure
=
(
char
*
)
taosMemoryMalloc
(
currElement
->
measureLen
);
memcpy
(
measure
,
currElement
->
measure
,
currElement
->
measureLen
);
PROCESS_SLASH_IN_MEASUREMENT
(
measure
,
measureLen
);
smlStrReplace
(
measure
,
measureLen
);
}
STableMeta
*
pTableMeta
=
smlGetMeta
(
info
,
measure
,
measureLen
);
if
(
currElement
->
measureEscaped
)
{
...
...
@@ -365,6 +366,7 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
measure
=
(
char
*
)
taosMemoryMalloc
(
currElement
->
measureLen
);
memcpy
(
measure
,
currElement
->
measure
,
currElement
->
measureLen
);
PROCESS_SLASH_IN_MEASUREMENT
(
measure
,
measureLen
);
smlStrReplace
(
measure
,
measureLen
);
}
STableMeta
*
pTableMeta
=
smlGetMeta
(
info
,
measure
,
measureLen
);
if
(
currElement
->
measureEscaped
)
{
...
...
tests/system-test/2-query/sml.py
浏览文件 @
2714db10
...
...
@@ -101,6 +101,15 @@ class TDTestCase:
tdSql
.
query
(
f
"desc
{
dbname
}
.macylr"
)
tdSql
.
checkRows
(
25
)
tdSql
.
query
(
f
"select * from ts3724._stb_2"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
f
"select * from ts3724.stb_2"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
f
"select * from ts3724.stb2_"
)
tdSql
.
checkRows
(
1
)
return
def
run
(
self
):
...
...
utils/test/c/sml_test.c
浏览文件 @
2714db10
...
...
@@ -1522,6 +1522,36 @@ int sml_ts2385_Test() {
return
code
;
}
int
sml_ts3724_Test
()
{
TAOS
*
taos
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS_RES
*
pRes
=
taos_query
(
taos
,
"drop database if exists ts3724"
);
taos_free_result
(
pRes
);
pRes
=
taos_query
(
taos
,
"create database if not exists ts3724"
);
taos_free_result
(
pRes
);
const
char
*
sql
[]
=
{
"stb.2,t1=1 f1=283i32 1632299372000"
,
".stb2,t1=1 f1=106i32 1632299378000"
,
"stb2.,t1=1 f1=106i32 1632299378000"
,
};
pRes
=
taos_query
(
taos
,
"use ts3724"
);
taos_free_result
(
pRes
);
pRes
=
taos_schemaless_insert
(
taos
,
(
char
**
)
sql
,
sizeof
(
sql
)
/
sizeof
(
sql
[
0
]),
TSDB_SML_LINE_PROTOCOL
,
TSDB_SML_TIMESTAMP_MILLI_SECONDS
);
int
code
=
taos_errno
(
pRes
);
printf
(
"%s result0:%s
\n
"
,
__FUNCTION__
,
taos_errstr
(
pRes
));
taos_free_result
(
pRes
);
taos_close
(
taos
);
return
code
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
==
2
)
{
taos_options
(
TSDB_OPTION_CONFIGDIR
,
argv
[
1
]);
...
...
@@ -1579,5 +1609,8 @@ int main(int argc, char *argv[]) {
ASSERT
(
!
ret
);
ret
=
sml_19221_Test
();
ASSERT
(
!
ret
);
ret
=
sml_ts3724_Test
();
ASSERT
(
!
ret
);
return
ret
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录