Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
517c8b1d
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看板
提交
517c8b1d
编写于
12月 06, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:modify influxdb parse logic for sml
上级
6d788b6b
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
854 addition
and
524 deletion
+854
-524
include/libs/parser/parser.h
include/libs/parser/parser.h
+5
-1
source/client/src/clientSml.c
source/client/src/clientSml.c
+772
-512
source/libs/parser/src/parInsertSml.c
source/libs/parser/src/parInsertSml.c
+77
-11
未找到文件。
include/libs/parser/parser.h
浏览文件 @
517c8b1d
...
...
@@ -108,7 +108,11 @@ int32_t qCreateSName(SName* pName, const char* pTableName, int32_t acctId, char*
void
qDestroyBoundColInfo
(
void
*
pInfo
);
SQuery
*
smlInitHandle
();
int32_t
smlBindData
(
SQuery
*
handle
,
SArray
*
tags
,
SArray
*
colsSchema
,
SArray
*
cols
,
bool
format
,
STableMeta
*
pTableMeta
,
int32_t
smlBuildRow
(
STableDataCxt
*
pTableCxt
);
int32_t
smlBuildCol
(
STableDataCxt
*
pTableCxt
,
SSchema
*
schema
,
void
*
kv
,
int32_t
index
);
STableDataCxt
*
smlInitTableDataCtx
(
SQuery
*
query
,
STableMeta
*
pTableMeta
);
int32_t
smlBindData
(
SQuery
*
handle
,
bool
dataFormat
,
SArray
*
tags
,
SArray
*
colsSchema
,
SArray
*
cols
,
STableMeta
*
pTableMeta
,
char
*
tableName
,
const
char
*
sTableName
,
int32_t
sTableNameLen
,
int32_t
ttl
,
char
*
msgBuf
,
int16_t
msgBufLen
);
int32_t
smlBuildOutput
(
SQuery
*
handle
,
SHashObj
*
pVgHash
);
...
...
source/client/src/clientSml.c
浏览文件 @
517c8b1d
此差异已折叠。
点击以展开。
source/libs/parser/src/parInsertSml.c
浏览文件 @
517c8b1d
...
...
@@ -56,7 +56,7 @@ static int32_t smlBoundColumnData(SArray* cols, SBoundColInfo* pBoundInfo, SSche
int32_t
code
=
TSDB_CODE_SUCCESS
;
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
cols
);
++
i
)
{
SSmlKv
*
kv
=
taosArrayGet
P
(
cols
,
i
);
SSmlKv
*
kv
=
taosArrayGet
(
cols
,
i
);
SToken
sToken
=
{.
n
=
kv
->
keyLen
,
.
z
=
(
char
*
)
kv
->
key
};
col_id_t
t
=
lastColIdx
+
1
;
col_id_t
index
=
((
t
==
0
&&
!
isTag
)
?
0
:
insFindCol
(
&
sToken
,
t
,
pBoundInfo
->
numOfCols
,
pSchema
));
...
...
@@ -111,7 +111,7 @@ static int32_t smlBuildTagRow(SArray* cols, SBoundColInfo* tags, SSchema* pSchem
int32_t
code
=
TSDB_CODE_SUCCESS
;
for
(
int
i
=
0
;
i
<
tags
->
numOfBound
;
++
i
)
{
SSchema
*
pTagSchema
=
&
pSchema
[
tags
->
pColIndex
[
i
]];
SSmlKv
*
kv
=
taosArrayGet
P
(
cols
,
i
);
SSmlKv
*
kv
=
taosArrayGet
(
cols
,
i
);
taosArrayPush
(
*
tagName
,
pTagSchema
->
name
);
STagVal
val
=
{.
cid
=
pTagSchema
->
colId
,
.
type
=
pTagSchema
->
type
};
...
...
@@ -158,7 +158,66 @@ end:
return
code
;
}
int32_t
smlBindData
(
SQuery
*
query
,
SArray
*
tags
,
SArray
*
colsSchema
,
SArray
*
cols
,
bool
format
,
STableMeta
*
pTableMeta
,
STableDataCxt
*
smlInitTableDataCtx
(
SQuery
*
query
,
STableMeta
*
pTableMeta
){
STableDataCxt
*
pTableCxt
=
NULL
;
int
ret
=
insGetTableDataCxt
(((
SVnodeModifOpStmt
*
)(
query
->
pRoot
))
->
pTableBlockHashObj
,
&
pTableMeta
->
uid
,
sizeof
(
pTableMeta
->
uid
),
pTableMeta
,
NULL
,
&
pTableCxt
,
false
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
NULL
;
}
ret
=
initTableColSubmitData
(
pTableCxt
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
NULL
;
}
return
pTableCxt
;
}
int32_t
smlBuildRow
(
STableDataCxt
*
pTableCxt
){
SRow
**
pRow
=
taosArrayReserve
(
pTableCxt
->
pData
->
aRowP
,
1
);
int
ret
=
tRowBuild
(
pTableCxt
->
pValues
,
pTableCxt
->
pSchema
,
pRow
);
if
(
TSDB_CODE_SUCCESS
!=
ret
)
{
return
ret
;
}
insCheckTableDataOrder
(
pTableCxt
,
TD_ROW_KEY
(
*
pRow
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
smlBuildCol
(
STableDataCxt
*
pTableCxt
,
SSchema
*
schema
,
void
*
data
,
int32_t
index
){
int
ret
=
TSDB_CODE_SUCCESS
;
SSchema
*
pColSchema
=
schema
+
index
;
SColVal
*
pVal
=
taosArrayGet
(
pTableCxt
->
pValues
,
index
);
SSmlKv
*
kv
=
(
SSmlKv
*
)
data
;
if
(
kv
->
type
==
TSDB_DATA_TYPE_NCHAR
){
int32_t
len
=
0
;
char
*
pUcs4
=
taosMemoryCalloc
(
1
,
pColSchema
->
bytes
-
VARSTR_HEADER_SIZE
);
if
(
NULL
==
pUcs4
)
{
ret
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
end
;
}
if
(
!
taosMbsToUcs4
(
kv
->
value
,
kv
->
length
,
(
TdUcs4
*
)
pUcs4
,
pColSchema
->
bytes
-
VARSTR_HEADER_SIZE
,
&
len
))
{
if
(
errno
==
E2BIG
)
{
ret
=
TSDB_CODE_PAR_VALUE_TOO_LONG
;
goto
end
;
}
ret
=
TSDB_CODE_TSC_INVALID_VALUE
;
goto
end
;
}
pVal
->
value
.
pData
=
pUcs4
;
pVal
->
value
.
nData
=
len
;
}
else
if
(
kv
->
type
==
TSDB_DATA_TYPE_BINARY
)
{
pVal
->
value
.
nData
=
kv
->
length
;
pVal
->
value
.
pData
=
(
uint8_t
*
)
kv
->
value
;
}
else
{
memcpy
(
&
pVal
->
value
.
val
,
&
(
kv
->
value
),
kv
->
length
);
}
pVal
->
flag
=
CV_FLAG_VALUE
;
end:
return
ret
;
}
int32_t
smlBindData
(
SQuery
*
query
,
bool
dataFormat
,
SArray
*
tags
,
SArray
*
colsSchema
,
SArray
*
cols
,
STableMeta
*
pTableMeta
,
char
*
tableName
,
const
char
*
sTableName
,
int32_t
sTableNameLen
,
int32_t
ttl
,
char
*
msgBuf
,
int16_t
msgBufLen
)
{
SMsgBuf
pBuf
=
{.
buf
=
msgBuf
,
.
len
=
msgBufLen
};
...
...
@@ -192,6 +251,18 @@ int32_t smlBindData(SQuery* query, SArray* tags, SArray* colsSchema, SArray* col
pCreateTblReq
->
ctb
.
stbName
=
taosMemoryCalloc
(
1
,
sTableNameLen
+
1
);
memcpy
(
pCreateTblReq
->
ctb
.
stbName
,
sTableName
,
sTableNameLen
);
if
(
dataFormat
){
STableDataCxt
**
pTableCxt
=
(
STableDataCxt
**
)
taosHashGet
(((
SVnodeModifOpStmt
*
)(
query
->
pRoot
))
->
pTableBlockHashObj
,
&
pTableMeta
->
uid
,
sizeof
(
pTableMeta
->
uid
));
if
(
NULL
==
pTableCxt
)
{
ret
=
buildInvalidOperationMsg
(
&
pBuf
,
"dataformat true. get tableDataCtx error"
);
goto
end
;
}
(
*
pTableCxt
)
->
pData
->
flags
|=
SUBMIT_REQ_AUTO_CREATE_TABLE
;
(
*
pTableCxt
)
->
pData
->
pCreateTbReq
=
pCreateTblReq
;
pCreateTblReq
=
NULL
;
goto
end
;
}
STableDataCxt
*
pTableCxt
=
NULL
;
ret
=
insGetTableDataCxt
(((
SVnodeModifOpStmt
*
)(
query
->
pRoot
))
->
pTableBlockHashObj
,
&
pTableMeta
->
uid
,
sizeof
(
pTableMeta
->
uid
),
pTableMeta
,
&
pCreateTblReq
,
&
pTableCxt
,
false
);
...
...
@@ -226,15 +297,10 @@ int32_t smlBindData(SQuery* query, SArray* tags, SArray* colsSchema, SArray* col
for
(
int
c
=
0
;
c
<
pTableCxt
->
boundColsInfo
.
numOfBound
;
++
c
)
{
SSchema
*
pColSchema
=
&
pSchema
[
pTableCxt
->
boundColsInfo
.
pColIndex
[
c
]];
SColVal
*
pVal
=
taosArrayGet
(
pTableCxt
->
pValues
,
pTableCxt
->
boundColsInfo
.
pColIndex
[
c
]);
SSmlKv
*
kv
=
NULL
;
if
(
!
format
){
void
**
p
=
taosHashGet
(
rowData
,
pColSchema
->
name
,
strlen
(
pColSchema
->
name
));
if
(
p
)
kv
=
*
p
;
}
void
**
p
=
taosHashGet
(
rowData
,
pColSchema
->
name
,
strlen
(
pColSchema
->
name
));
if
(
p
==
NULL
)
continue
;
SSmlKv
*
kv
=
*
(
SSmlKv
**
)
p
;
if
(
kv
==
NULL
)
{
continue
;
}
if
(
pColSchema
->
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
kv
->
i
=
convertTimePrecision
(
kv
->
i
,
TSDB_TIME_PRECISION_NANO
,
pTableMeta
->
tableInfo
.
precision
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录