Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6b9162ad
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
6b9162ad
编写于
1月 09, 2023
作者:
D
dapan1121
提交者:
GitHub
1月 09, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19401 from taosdata/fix/TS-2385
fix:table name error in schemaless
上级
1cc5f593
060fc941
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
68 addition
and
13 deletion
+68
-13
include/common/tname.h
include/common/tname.h
+1
-1
source/client/src/clientSml.c
source/client/src/clientSml.c
+5
-8
source/common/src/tname.c
source/common/src/tname.c
+0
-1
tests/system-test/2-query/sml.py
tests/system-test/2-query/sml.py
+6
-1
utils/test/c/sml_test.c
utils/test/c/sml_test.c
+56
-2
未找到文件。
include/common/tname.h
浏览文件 @
6b9162ad
...
...
@@ -78,7 +78,7 @@ typedef struct {
// output
char
*
ctbShortName
;
// must have size of TSDB_TABLE_NAME_LEN;
uint64_t
uid
;
// child table uid, may be useful
//
uint64_t uid; // child table uid, may be useful
}
RandTableName
;
void
buildChildTableName
(
RandTableName
*
rName
);
...
...
source/client/src/clientSml.c
浏览文件 @
6b9162ad
...
...
@@ -182,6 +182,7 @@ typedef struct {
SSmlMsgBuf
msgBuf
;
SHashObj
*
dumplicateKey
;
// for dumplicate key
SArray
*
colsContainer
;
// for cols parse, if dataFormat == false
int32_t
uid
;
// used for automatic create child table
cJSON
*
root
;
// for parse json
}
SSmlHandle
;
...
...
@@ -2155,13 +2156,11 @@ static int32_t smlParseInfluxLine(SSmlHandle *info, const char *sql, const int l
(
*
oneTable
)
->
sTableNameLen
=
elements
.
measureLen
;
if
(
strlen
((
*
oneTable
)
->
childTableName
)
==
0
)
{
RandTableName
rName
=
{(
*
oneTable
)
->
tags
,
(
*
oneTable
)
->
sTableName
,
(
uint8_t
)(
*
oneTable
)
->
sTableNameLen
,
(
*
oneTable
)
->
childTableName
,
0
};
(
*
oneTable
)
->
childTableName
};
buildChildTableName
(
&
rName
);
(
*
oneTable
)
->
uid
=
rName
.
uid
;
}
else
{
(
*
oneTable
)
->
uid
=
*
(
uint64_t
*
)((
*
oneTable
)
->
childTableName
);
}
(
*
oneTable
)
->
uid
=
info
->
uid
++
;
}
SSmlSTableMeta
**
tableMeta
=
(
SSmlSTableMeta
**
)
taosHashGet
(
info
->
superTables
,
elements
.
measure
,
elements
.
measureLen
);
...
...
@@ -2226,11 +2225,8 @@ static int32_t smlParseTelnetLine(SSmlHandle *info, void *data, const int len) {
taosHashClear
(
info
->
dumplicateKey
);
if
(
strlen
(
tinfo
->
childTableName
)
==
0
)
{
RandTableName
rName
=
{
tinfo
->
tags
,
tinfo
->
sTableName
,
(
uint8_t
)
tinfo
->
sTableNameLen
,
tinfo
->
childTableName
,
0
};
RandTableName
rName
=
{
tinfo
->
tags
,
tinfo
->
sTableName
,
(
uint8_t
)
tinfo
->
sTableNameLen
,
tinfo
->
childTableName
};
buildChildTableName
(
&
rName
);
tinfo
->
uid
=
rName
.
uid
;
}
else
{
tinfo
->
uid
=
*
(
uint64_t
*
)(
tinfo
->
childTableName
);
// generate uid by name simple
}
bool
hasTable
=
true
;
...
...
@@ -2239,6 +2235,7 @@ static int32_t smlParseTelnetLine(SSmlHandle *info, void *data, const int len) {
if
(
!
oneTable
)
{
taosHashPut
(
info
->
childTables
,
tinfo
->
childTableName
,
strlen
(
tinfo
->
childTableName
),
&
tinfo
,
POINTER_BYTES
);
oneTable
=
&
tinfo
;
tinfo
->
uid
=
info
->
uid
++
;
hasTable
=
false
;
}
else
{
smlDestroyTableInfo
(
info
,
tinfo
);
...
...
source/common/src/tname.c
浏览文件 @
6b9162ad
...
...
@@ -330,5 +330,4 @@ void buildChildTableName(RandTableName* rName) {
strcat
(
rName
->
ctbShortName
,
temp
);
}
taosStringBuilderDestroy
(
&
sb
);
rName
->
uid
=
*
(
uint64_t
*
)(
context
.
digest
);
}
tests/system-test/2-query/sml.py
浏览文件 @
6b9162ad
...
...
@@ -15,6 +15,9 @@ sys.path.append("./7-tmq")
from
tmqCommon
import
*
class
TDTestCase
:
updatecfgDict
=
{
'clientCfg'
:
{
'smlChildTableName'
:
'dataModelName'
,
'fqdn'
:
'localhost'
},
'fqdn'
:
'localhost'
}
print
(
"===================: "
,
updatecfgDict
)
def
init
(
self
,
conn
,
logSql
,
replicaVar
=
1
):
self
.
replicaVar
=
int
(
replicaVar
)
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
...
...
@@ -22,8 +25,10 @@ class TDTestCase:
#tdSql.init(conn.cursor(), logSql) # output sql.txt file
def
checkFileContent
(
self
,
dbname
=
"sml_db"
):
simClientCfg
=
"%s/taos.cfg"
%
tdDnodes
.
getSimCfgPath
()
buildPath
=
tdCom
.
getBuildPath
()
cmdStr
=
'%s/build/bin/sml_test'
%
(
buildPath
)
cmdStr
=
'%s/build/bin/sml_test %s'
%
(
buildPath
,
simClientCfg
)
print
(
"cmdStr:"
,
cmdStr
)
tdLog
.
info
(
cmdStr
)
ret
=
os
.
system
(
cmdStr
)
if
ret
!=
0
:
...
...
utils/test/c/sml_test.c
浏览文件 @
6b9162ad
...
...
@@ -1131,8 +1131,10 @@ int sml_ttl_Test() {
pRes
=
taos_query
(
taos
,
"select `ttl` from information_schema.ins_tables where table_name='t_be97833a0e1f523fcdaeb6291d6fdf27'"
);
printf
(
"%s result2:%s
\n
"
,
__FUNCTION__
,
taos_errstr
(
pRes
));
TAOS_ROW
row
=
taos_fetch_row
(
pRes
);
int32_t
ttl
=
*
(
int32_t
*
)
row
[
0
];
ASSERT
(
ttl
==
20
);
if
(
row
!=
NULL
&&
row
[
0
]
!=
NULL
){
int32_t
ttl
=
*
(
int32_t
*
)
row
[
0
];
ASSERT
(
ttl
==
20
);
}
int
code
=
taos_errno
(
pRes
);
taos_free_result
(
pRes
);
...
...
@@ -1141,8 +1143,60 @@ int sml_ttl_Test() {
return
code
;
}
int
sml_ts2385_Test
()
{
TAOS
*
taos
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS_RES
*
pRes
=
taos_query
(
taos
,
"CREATE DATABASE IF NOT EXISTS ts2385"
);
taos_free_result
(
pRes
);
const
char
*
sql
[]
=
{
"DataRTU,deviceId=2211230C94K0_1,dataModelName=DataRTU_2211230C94K0_1 s5=false,s18=false,k14=0,k2=0,k8=0,k10=0,s9=false,s19=false,k11=0,k13=0,s22=false,k15=0,m2=37.416671660000006,m8=600,m10=1532,m1=20.25,m13=0,s7=false,k7=0,m16=0,s17=false,k4=0,s11=false,s15=true,m7=600,m12=1490,s1=true,m14=0,s14=false,s16=true,k5=0,hex=
\"
7b3b00000001030301030200000000323231313233304339344b30002b01012a10028003000000070d05da025802580258025802580258045305fc05f505d200000000000000000afc7d
\"
,k6=0,m3=600,s3=false,s24=false,k3=0,m6=600,m15=0,s12=false,k1=0,k16=0,s10=false,s21=false,k12=0,m5=600,s8=false,m4=600,m9=1107,s2=false,s13=false,s20=false,s23=false,k9=0,m11=1525,s4=false,s6=false 1672818929178749400"
,
"DataRTU,deviceId=2211230C94K0_1,dataModelName=DataRTU_2211230C94K0_1 k2=0,k11=0,m3=600,m12=1506,s17=false,m5=600,s11=false,s22=false,k6=0,m13=0,s16=true,k5=0,s21=false,m4=600,m7=600,s9=false,s10=false,s18=false,k7=0,m8=600,k1=0,hex=
\"
7b3a00000001030301030200000000323231313233304339344b30002b01012a10028003000000071105e8025802580258025802580258044905eb05ef05e200000000000000000afc7d
\"
,m11=1519,m16=0,s19=false,s23=false,s24=false,s14=false,s6=false,k10=0,k15=0,k14=0,s2=false,s4=false,s8=false,s13=false,s15=true,s20=false,m2=38.000005040000005,s3=false,s7=false,k3=0,k8=0,k13=0,m6=600,m14=0,m15=0,k4=0,m1=20.450000000000003,m9=1097,s1=true,m10=1515,s5=false,s12=false,k9=0,k12=0,k16=0 1672818919126971000"
,
"DataRTU,deviceId=2211230C94K0_1,dataModelName=DataRTU_2211230C94K0_1 k7=0,k14=0,m3=600,m7=600,s5=false,k2=0,k3=0,k8=0,s3=false,s20=false,k15=0,m10=1482,s17=false,k1=0,k16=0,m15=0,s12=false,k9=0,m16=0,s11=false,m4=600,s10=false,s15=true,s24=false,m8=600,m13=0,s2=false,s18=false,k12=0,s14=false,s19=false,hex=
\"
7b3900000001030301030200000000323231313233304339344b30002b01012a10028003000000071505ef025802580258025802580258045005ca05b105d800000000000000000aa47d
\"
,s1=true,s4=false,s7=false,s8=false,s13=false,m6=600,s6=false,s21=false,k11=0,m12=1496,m9=1104,s16=true,k5=0,s9=false,k10=0,k13=0,m2=38.291671730000004,s22=false,m5=600,m11=1457,m14=0,k4=0,m1=20.650000000000006,s23=false,k6=0 1672818909130866800"
,
"DataRTU,deviceId=2211230C94K0_1,dataModelName=DataRTU_2211230C94K0_1 m7=600,k4=0,k14=0,s22=false,k13=0,s2=false,m11=1510,m14=0,s4=false,s10=false,m1=21,m16=0,m13=0,s9=false,s13=false,s14=false,k10=0,m3=600,m9=1107,s18=false,s19=false,k2=0,hex=
\"
7b3600000001030301030200000000323231313233304339344b30002b01012a10028003000000071c0619025802580258025802580258045305dc05e6058d00000000000000000ad27d
\"
,m2=40.04167187,m8=600,k7=0,k8=0,m10=1500,s23=false,k5=0,s11=false,s21=false,k9=0,m15=0,m12=1421,s1=true,s5=false,s8=false,m5=600,k16=0,k15=0,m6=600,s3=false,s6=false,s7=false,s15=true,s20=false,s24=false,k11=0,k1=0,k6=0,k12=0,m4=600,s16=true,s17=false,k3=0,s12=false 1672818879189483200"
,
"DataRTU,deviceId=2106070C11M0_2,dataModelName=DataRTU_2106070C11M0_2 m1=5691,k14=0,m6=0,s14=false,k8=0,s19=false,s20=false,k12=0,s17=false,k3=0,m8=0,s8=false,m7=0,s9=false,s4=false,s11=false,s13=false,s16=false,k5=0,k15=0,k16=0,s10=false,s23=false,s1=false,s2=false,s3=false,s12=false,s24=false,k2=0,k10=0,hex=
\"
7b1400000001030301030200000000323130363037304331314d30002b01022a080400000000000008af0c000000000000000000000000000000000000000000000000000000000ad47d
\"
,m2=0,s7=false,s18=false,s21=false,m3=0,m5=0,k4=0,k11=0,m4=0,k1=0,k6=0,k13=0,s6=false,s15=false,s5=false,s22=false,k7=0,k9=0 1672818779549848800"
};
pRes
=
taos_query
(
taos
,
"use ts2385"
);
taos_free_result
(
pRes
);
pRes
=
taos_schemaless_insert
(
taos
,
(
char
**
)
sql
,
sizeof
(
sql
)
/
sizeof
(
sql
[
0
]),
TSDB_SML_LINE_PROTOCOL
,
TSDB_SML_TIMESTAMP_NANO_SECONDS
);
printf
(
"%s result:%s
\n
"
,
__FUNCTION__
,
taos_errstr
(
pRes
));
int
code
=
taos_errno
(
pRes
);
ASSERT
(
!
code
);
taos_free_result
(
pRes
);
pRes
=
taos_query
(
taos
,
"select distinct tbname from `DataRTU` order by tbname"
);
printf
(
"%s result2:%s
\n
"
,
__FUNCTION__
,
taos_errstr
(
pRes
));
int
num
=
0
;
TAOS_ROW
row
=
NULL
;
while
((
row
=
taos_fetch_row
(
pRes
))){
if
(
row
[
0
]
!=
NULL
&&
num
==
0
){
ASSERT
(
strncmp
((
char
*
)
row
[
0
],
"DataRTU_2106070C11M0_2"
,
sizeof
(
"DataRTU_2106070C11M0_2"
)
-
1
)
==
0
);
}
if
(
row
[
0
]
!=
NULL
&&
num
==
1
){
ASSERT
(
strncmp
((
char
*
)
row
[
0
],
"DataRTU_2211230C94K0_1"
,
sizeof
(
"DataRTU_2211230C94K0_1"
)
-
1
)
==
0
);
}
num
++
;
}
ASSERT
(
num
==
2
);
code
=
taos_errno
(
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
]);
}
int
ret
=
0
;
ret
=
sml_ts2385_Test
();
ASSERT
(
!
ret
);
ret
=
sml_ttl_Test
();
ASSERT
(
!
ret
);
ret
=
sml_ts2164_Test
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录