Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
54558b43
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
未验证
提交
54558b43
编写于
1月 09, 2023
作者:
D
dapan1121
提交者:
GitHub
1月 09, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19448 from taosdata/refact/submit_req_marks
fix:table name error in schemaless
上级
4a819178
a462f518
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
67 addition
and
8 deletion
+67
-8
include/common/tname.h
include/common/tname.h
+1
-1
source/client/inc/clientSml.h
source/client/inc/clientSml.h
+1
-0
source/client/src/clientSml.c
source/client/src/clientSml.c
+1
-4
source/client/src/clientSmlJson.c
source/client/src/clientSmlJson.c
+1
-0
source/client/src/clientSmlLine.c
source/client/src/clientSmlLine.c
+1
-0
source/client/src/clientSmlTelnet.c
source/client/src/clientSmlTelnet.c
+1
-0
source/common/src/tname.c
source/common/src/tname.c
+1
-1
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+1
-0
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
+53
-1
未找到文件。
include/common/tname.h
浏览文件 @
54558b43
...
...
@@ -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/inc/clientSml.h
浏览文件 @
54558b43
...
...
@@ -164,6 +164,7 @@ typedef struct {
bool
dataFormat
;
// true means that the name and order of keys in each line are the same(only for influx protocol)
bool
isRawLine
;
int32_t
ttl
;
int32_t
uid
;
// used for automatic create child table
NodeList
*
childTables
;
NodeList
*
superTables
;
...
...
source/client/src/clientSml.c
浏览文件 @
54558b43
...
...
@@ -186,13 +186,10 @@ int32_t smlSetCTableName(SSmlTableInfo *oneTable) {
if
(
strlen
(
oneTable
->
childTableName
)
==
0
)
{
SArray
*
dst
=
taosArrayDup
(
oneTable
->
tags
,
NULL
);
RandTableName
rName
=
{
dst
,
oneTable
->
sTableName
,
(
uint8_t
)
oneTable
->
sTableNameLen
,
oneTable
->
childTableName
,
0
};
RandTableName
rName
=
{
dst
,
oneTable
->
sTableName
,
(
uint8_t
)
oneTable
->
sTableNameLen
,
oneTable
->
childTableName
};
buildChildTableName
(
&
rName
);
taosArrayDestroy
(
dst
);
oneTable
->
uid
=
rName
.
uid
;
}
else
{
oneTable
->
uid
=
*
(
uint64_t
*
)(
oneTable
->
childTableName
);
}
return
TSDB_CODE_SUCCESS
;
}
...
...
source/client/src/clientSmlJson.c
浏览文件 @
54558b43
...
...
@@ -781,6 +781,7 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
tinfo
->
tags
=
taosArrayDup
(
preLineKV
,
NULL
);
smlSetCTableName
(
tinfo
);
tinfo
->
uid
=
info
->
uid
++
;
if
(
info
->
dataFormat
)
{
info
->
currSTableMeta
->
uid
=
tinfo
->
uid
;
tinfo
->
tableDataCtx
=
smlInitTableDataCtx
(
info
->
pQuery
,
info
->
currSTableMeta
);
...
...
source/client/src/clientSmlLine.c
浏览文件 @
54558b43
...
...
@@ -322,6 +322,7 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd,
tinfo
->
tags
=
taosArrayDup
(
preLineKV
,
NULL
);
smlSetCTableName
(
tinfo
);
tinfo
->
uid
=
info
->
uid
++
;
if
(
info
->
dataFormat
)
{
info
->
currSTableMeta
->
uid
=
tinfo
->
uid
;
tinfo
->
tableDataCtx
=
smlInitTableDataCtx
(
info
->
pQuery
,
info
->
currSTableMeta
);
...
...
source/client/src/clientSmlTelnet.c
浏览文件 @
54558b43
...
...
@@ -238,6 +238,7 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
tinfo
->
tags
=
taosArrayDup
(
preLineKV
,
NULL
);
smlSetCTableName
(
tinfo
);
tinfo
->
uid
=
info
->
uid
++
;
if
(
info
->
dataFormat
)
{
info
->
currSTableMeta
->
uid
=
tinfo
->
uid
;
tinfo
->
tableDataCtx
=
smlInitTableDataCtx
(
info
->
pQuery
,
info
->
currSTableMeta
);
...
...
source/common/src/tname.c
浏览文件 @
54558b43
...
...
@@ -328,5 +328,5 @@ void buildChildTableName(RandTableName* rName) {
strcat
(
rName
->
ctbShortName
,
temp
);
}
taosStringBuilderDestroy
(
&
sb
);
rName
->
uid
=
*
(
uint64_t
*
)(
context
.
digest
);
//
rName->uid = *(uint64_t*)(context.digest);
}
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
54558b43
...
...
@@ -1001,6 +1001,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
code
=
terrno
;
goto
_exit
;
}
pSubmitTbData
->
uid
=
pSubmitTbData
->
pCreateTbReq
->
uid
;
// update uid if table exist for using below
}
}
...
...
tests/system-test/2-query/sml.py
浏览文件 @
54558b43
...
...
@@ -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
浏览文件 @
54558b43
...
...
@@ -974,12 +974,64 @@ int sml_ttl_Test() {
// return sum;
//}
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
);
// for(int i = 0; i < sizeof(str)/sizeof(str[0]); i++){
// printf("str:%s \t %d\n", str[i], smlCalTypeSum(str[i], strlen(str[i])));
// }
int
ret
=
0
;
//
int ret = 0;
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录