Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4827c25a
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4827c25a
编写于
3月 04, 2023
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:give error if col is same in schemless & fix json parse error in TD-22903
上级
3bfd1566
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
42 addition
and
86 deletion
+42
-86
source/client/inc/clientSml.h
source/client/inc/clientSml.h
+1
-1
source/client/src/clientSml.c
source/client/src/clientSml.c
+0
-3
source/client/src/clientSmlJson.c
source/client/src/clientSmlJson.c
+2
-2
source/client/src/clientSmlLine.c
source/client/src/clientSmlLine.c
+37
-78
source/client/src/clientSmlTelnet.c
source/client/src/clientSmlTelnet.c
+2
-2
未找到文件。
source/client/inc/clientSml.h
浏览文件 @
4827c25a
...
...
@@ -190,7 +190,7 @@ typedef struct {
//
SArray
*
preLineTagKV
;
SArray
*
maxTagKVs
;
SArray
*
preLineColKV
;
SArray
*
masColKVs
;
SSmlLineInfo
preLine
;
STableMeta
*
currSTableMeta
;
...
...
source/client/src/clientSml.c
浏览文件 @
4827c25a
...
...
@@ -817,7 +817,6 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
if
(
i
<
pTableMeta
->
tableInfo
.
numOfColumns
)
{
taosArrayPush
(
pColumns
,
&
field
);
}
else
{
uError
(
"SML:0x%"
PRIx64
"field name:%s, bytes:%d"
,
info
->
id
,
field
.
name
,
field
.
bytes
);
taosArrayPush
(
pTags
,
&
field
);
}
}
...
...
@@ -1074,7 +1073,6 @@ void smlDestroyInfo(SSmlHandle *info) {
taosArrayDestroy
(
info
->
valueJsonArray
);
taosArrayDestroy
(
info
->
preLineTagKV
);
taosArrayDestroy
(
info
->
preLineColKV
);
if
(
!
info
->
dataFormat
)
{
for
(
int
i
=
0
;
i
<
info
->
lineNum
;
i
++
)
{
...
...
@@ -1117,7 +1115,6 @@ SSmlHandle *smlBuildSmlInfo(TAOS *taos) {
info
->
tagJsonArray
=
taosArrayInit
(
8
,
POINTER_BYTES
);
info
->
valueJsonArray
=
taosArrayInit
(
8
,
POINTER_BYTES
);
info
->
preLineTagKV
=
taosArrayInit
(
8
,
sizeof
(
SSmlKv
));
info
->
preLineColKV
=
taosArrayInit
(
8
,
sizeof
(
SSmlKv
));
if
(
NULL
==
info
->
pVgHash
||
NULL
==
info
->
childTables
||
NULL
==
info
->
superTables
)
{
uError
(
"create SSmlHandle failed"
);
...
...
source/client/src/clientSmlJson.c
浏览文件 @
4827c25a
...
...
@@ -686,7 +686,7 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
if
(
info
->
dataFormat
)
{
if
(
unlikely
(
!
isSameMeasure
))
{
SSmlSTableMeta
**
tmp
=
(
SSmlSTableMeta
**
)
taosHashGet
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
);
SSmlSTableMeta
*
sMeta
=
NULL
;
SSmlSTableMeta
*
sMeta
=
NULL
;
if
(
unlikely
(
tmp
==
NULL
))
{
STableMeta
*
pTableMeta
=
smlGetMeta
(
info
,
elements
->
measure
,
elements
->
measureLen
);
if
(
pTableMeta
==
NULL
)
{
...
...
@@ -697,12 +697,12 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
sMeta
=
smlBuildSTableMeta
(
info
->
dataFormat
);
sMeta
->
tableMeta
=
pTableMeta
;
taosHashPut
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
&
sMeta
,
POINTER_BYTES
);
tmp
=
&
sMeta
;
for
(
int
i
=
pTableMeta
->
tableInfo
.
numOfColumns
;
i
<
pTableMeta
->
tableInfo
.
numOfTags
+
pTableMeta
->
tableInfo
.
numOfColumns
;
i
++
){
SSchema
*
tag
=
pTableMeta
->
schema
+
i
;
SSmlKv
kv
=
{.
key
=
tag
->
name
,
.
keyLen
=
strlen
(
tag
->
name
),
.
type
=
tag
->
type
,
.
length
=
(
tag
->
bytes
-
VARSTR_HEADER_SIZE
)
/
TSDB_NCHAR_SIZE
};
taosArrayPush
(
sMeta
->
tags
,
&
kv
);
}
tmp
=
&
sMeta
;
}
info
->
currSTableMeta
=
(
*
tmp
)
->
tableMeta
;
info
->
maxTagKVs
=
(
*
tmp
)
->
tags
;
...
...
source/client/src/clientSmlLine.c
浏览文件 @
4827c25a
...
...
@@ -149,6 +149,7 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
SSmlSTableMeta
**
tmp
=
(
SSmlSTableMeta
**
)
taosHashGet
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
);
SSmlSTableMeta
*
sMeta
=
NULL
;
if
(
unlikely
(
tmp
==
NULL
))
{
STableMeta
*
pTableMeta
=
smlGetMeta
(
info
,
currElement
->
measure
,
currElement
->
measureLen
);
if
(
pTableMeta
==
NULL
)
{
...
...
@@ -156,16 +157,15 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
}
SSmlSTableMeta
*
sMeta
=
smlBuildSTableMeta
(
info
->
dataFormat
);
sMeta
=
smlBuildSTableMeta
(
info
->
dataFormat
);
sMeta
->
tableMeta
=
pTableMeta
;
taosHashPut
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
,
&
sMeta
,
POINTER_BYTES
);
tmp
=
&
sMeta
;
for
(
int
i
=
pTableMeta
->
tableInfo
.
numOfColumns
;
i
<
pTableMeta
->
tableInfo
.
numOfTags
+
pTableMeta
->
tableInfo
.
numOfColumns
;
i
++
){
SSchema
*
tag
=
pTableMeta
->
schema
+
i
;
SSmlKv
kv
=
{.
key
=
tag
->
name
,
.
keyLen
=
strlen
(
tag
->
name
),
.
type
=
tag
->
type
,
.
length
=
(
tag
->
bytes
-
VARSTR_HEADER_SIZE
)
/
TSDB_NCHAR_SIZE
};
taosArrayPush
(
sMeta
->
tags
,
&
kv
);
}
tmp
=
&
sMeta
;
}
info
->
currSTableMeta
=
(
*
tmp
)
->
tableMeta
;
info
->
maxTagKVs
=
(
*
tmp
)
->
tags
;
...
...
@@ -305,9 +305,6 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
static
int32_t
smlParseColKv
(
SSmlHandle
*
info
,
char
**
sql
,
char
*
sqlEnd
,
SSmlLineInfo
*
currElement
,
bool
isSameMeasure
,
bool
isSameCTable
)
{
int
cnt
=
0
;
SArray
*
preLineKV
=
info
->
preLineColKV
;
bool
isSuperKVInit
=
true
;
SArray
*
superKV
=
NULL
;
if
(
info
->
dataFormat
)
{
if
(
unlikely
(
!
isSameCTable
))
{
SSmlTableInfo
**
oneTable
=
...
...
@@ -322,7 +319,6 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
if
(
unlikely
(
!
isSameMeasure
))
{
SSmlSTableMeta
**
tmp
=
(
SSmlSTableMeta
**
)
taosHashGet
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
);
SSmlSTableMeta
*
sMeta
=
NULL
;
if
(
unlikely
(
tmp
==
NULL
))
{
STableMeta
*
pTableMeta
=
smlGetMeta
(
info
,
currElement
->
measure
,
currElement
->
measureLen
);
if
(
pTableMeta
==
NULL
)
{
...
...
@@ -330,17 +326,23 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
}
sMeta
=
smlBuildSTableMeta
(
info
->
dataFormat
);
sMeta
->
tableMeta
=
pTableMeta
;
taosHashPut
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
,
&
sMeta
,
POINTER_BYTES
);
tmp
=
&
sMeta
;
*
tmp
=
smlBuildSTableMeta
(
info
->
dataFormat
);
(
*
tmp
)
->
tableMeta
=
pTableMeta
;
taosHashPut
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
,
tmp
,
POINTER_BYTES
);
for
(
int
i
=
0
;
i
<
pTableMeta
->
tableInfo
.
numOfColumns
;
i
++
){
SSchema
*
tag
=
pTableMeta
->
schema
+
i
;
SSmlKv
kv
=
{.
key
=
tag
->
name
,
.
keyLen
=
strlen
(
tag
->
name
),
.
type
=
tag
->
type
};
if
(
tag
->
type
==
TSDB_DATA_TYPE_NCHAR
){
kv
.
length
=
(
tag
->
bytes
-
VARSTR_HEADER_SIZE
)
/
TSDB_NCHAR_SIZE
;
}
else
if
(
tag
->
type
==
TSDB_DATA_TYPE_BINARY
){
kv
.
length
=
tag
->
bytes
-
VARSTR_HEADER_SIZE
;
}
taosArrayPush
((
*
tmp
)
->
cols
,
&
kv
);
}
}
info
->
currSTableMeta
=
(
*
tmp
)
->
tableMeta
;
superKV
=
(
*
tmp
)
->
cols
;
if
(
unlikely
(
taosArrayGetSize
(
superKV
)
==
0
))
{
isSuperKVInit
=
false
;
}
taosArrayClear
(
preLineKV
);
info
->
masColKVs
=
(
*
tmp
)
->
cols
;
}
}
...
...
@@ -439,69 +441,26 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
}
if
(
cnt
>=
taosArrayGetSize
(
info
->
masColKVs
))
{
info
->
dataFormat
=
false
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
}
SSmlKv
*
maxKV
=
(
SSmlKv
*
)
taosArrayGet
(
info
->
masColKVs
,
cnt
);
if
(
kv
.
type
!=
maxKV
->
type
)
{
info
->
dataFormat
=
false
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
}
if
(
unlikely
(
!
IS_SAME_KEY
))
{
info
->
dataFormat
=
false
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
}
if
(
isSameMeasure
)
{
if
(
cnt
>=
taosArrayGetSize
(
preLineKV
))
{
info
->
dataFormat
=
false
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
}
SSmlKv
*
maxKV
=
(
SSmlKv
*
)
taosArrayGet
(
preLineKV
,
cnt
);
if
(
kv
.
type
!=
maxKV
->
type
)
{
info
->
dataFormat
=
false
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
}
if
(
unlikely
(
IS_VAR_DATA_TYPE
(
kv
.
type
)
&&
kv
.
length
>
maxKV
->
length
))
{
maxKV
->
length
=
kv
.
length
;
SSmlSTableMeta
**
tableMeta
=
(
SSmlSTableMeta
**
)
taosHashGet
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
);
if
(
unlikely
(
NULL
==
tableMeta
))
{
uError
(
"SML:0x%"
PRIx64
" NULL == tableMeta"
,
info
->
id
);
return
TSDB_CODE_SML_INTERNAL_ERROR
;
}
SSmlKv
*
oldKV
=
(
SSmlKv
*
)
taosArrayGet
((
*
tableMeta
)
->
cols
,
cnt
);
oldKV
->
length
=
kv
.
length
;
info
->
needModifySchema
=
true
;
}
if
(
unlikely
(
!
IS_SAME_KEY
))
{
info
->
dataFormat
=
false
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
}
}
else
{
if
(
isSuperKVInit
)
{
if
(
unlikely
(
cnt
>=
taosArrayGetSize
(
superKV
)))
{
info
->
dataFormat
=
false
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
}
SSmlKv
*
maxKV
=
(
SSmlKv
*
)
taosArrayGet
(
superKV
,
cnt
);
if
(
unlikely
(
kv
.
type
!=
maxKV
->
type
))
{
info
->
dataFormat
=
false
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
}
if
(
IS_VAR_DATA_TYPE
(
kv
.
type
))
{
if
(
kv
.
length
>
maxKV
->
length
)
{
maxKV
->
length
=
kv
.
length
;
}
else
{
kv
.
length
=
maxKV
->
length
;
}
info
->
needModifySchema
=
true
;
}
if
(
unlikely
(
!
IS_SAME_KEY
))
{
info
->
dataFormat
=
false
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
}
}
else
{
taosArrayPush
(
superKV
,
&
kv
);
}
taosArrayPush
(
preLineKV
,
&
kv
);
if
(
unlikely
(
IS_VAR_DATA_TYPE
(
kv
.
type
)
&&
kv
.
length
>
maxKV
->
length
))
{
maxKV
->
length
=
kv
.
length
;
info
->
needModifySchema
=
true
;
}
}
else
{
if
(
currElement
->
colArray
==
NULL
)
{
...
...
source/client/src/clientSmlTelnet.c
浏览文件 @
4827c25a
...
...
@@ -82,7 +82,7 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
if
(
info
->
dataFormat
)
{
if
(
!
isSameMeasure
)
{
SSmlSTableMeta
**
tmp
=
(
SSmlSTableMeta
**
)
taosHashGet
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
);
SSmlSTableMeta
*
sMeta
=
NULL
;
SSmlSTableMeta
*
sMeta
=
NULL
;
if
(
unlikely
(
tmp
==
NULL
))
{
STableMeta
*
pTableMeta
=
smlGetMeta
(
info
,
elements
->
measure
,
elements
->
measureLen
);
if
(
pTableMeta
==
NULL
)
{
...
...
@@ -93,12 +93,12 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
sMeta
=
smlBuildSTableMeta
(
info
->
dataFormat
);
sMeta
->
tableMeta
=
pTableMeta
;
taosHashPut
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
&
sMeta
,
POINTER_BYTES
);
tmp
=
&
sMeta
;
for
(
int
i
=
pTableMeta
->
tableInfo
.
numOfColumns
;
i
<
pTableMeta
->
tableInfo
.
numOfTags
+
pTableMeta
->
tableInfo
.
numOfColumns
;
i
++
){
SSchema
*
tag
=
pTableMeta
->
schema
+
i
;
SSmlKv
kv
=
{.
key
=
tag
->
name
,
.
keyLen
=
strlen
(
tag
->
name
),
.
type
=
tag
->
type
,
.
length
=
(
tag
->
bytes
-
VARSTR_HEADER_SIZE
)
/
TSDB_NCHAR_SIZE
};
taosArrayPush
(
sMeta
->
tags
,
&
kv
);
}
tmp
=
&
sMeta
;
}
info
->
currSTableMeta
=
(
*
tmp
)
->
tableMeta
;
info
->
maxTagKVs
=
(
*
tmp
)
->
tags
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录