Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e24b03f8
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看板
提交
e24b03f8
编写于
12月 10, 2021
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
6c1fde6d
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
18 addition
and
17 deletion
+18
-17
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+18
-17
未找到文件。
src/client/src/tscParseInsert.c
浏览文件 @
e24b03f8
...
@@ -444,14 +444,12 @@ int32_t tsCheckTimestamp(STableDataBlocks *pDataBlocks, const char *start) {
...
@@ -444,14 +444,12 @@ int32_t tsCheckTimestamp(STableDataBlocks *pDataBlocks, const char *start) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int
tsParseOneRow
(
char
**
str
,
STableDataBlocks
*
pDataBlocks
,
int16_t
timePrec
,
bool
*
isConverted
,
int32_t
rowSize
,
int
tsParseOneRow
(
char
**
str
,
STableDataBlocks
*
pDataBlocks
,
int16_t
timePrec
,
int32_t
*
convertIndex
,
int32_t
rowSize
,
char
*
tmpTokenBuf
,
SInsertStatementParam
*
pInsertParam
)
{
char
*
tmpTokenBuf
,
SInsertStatementParam
*
pInsertParam
)
{
int32_t
index
=
0
;
int32_t
index
=
0
;
SStrToken
sToken
=
{
0
};
SStrToken
sToken
=
{
0
};
char
*
row
=
pDataBlocks
->
pData
+
char
*
row
=
pDataBlocks
->
pData
+
(
pDataBlocks
->
size
-
(
*
convertIndex
)
*
rowSize
);
// skip the SSubmitBlk header
((
*
isConverted
)
?
(
pDataBlocks
->
size
-
rowSize
)
:
pDataBlocks
->
size
);
// skip the SSubmitBlk header
*
isConverted
=
false
;
SParsedDataColInfo
*
spd
=
&
pDataBlocks
->
boundColumnInfo
;
SParsedDataColInfo
*
spd
=
&
pDataBlocks
->
boundColumnInfo
;
STableMeta
*
pTableMeta
=
pDataBlocks
->
pTableMeta
;
STableMeta
*
pTableMeta
=
pDataBlocks
->
pTableMeta
;
...
@@ -570,8 +568,11 @@ int tsParseOneRow(char **str, STableDataBlocks *pDataBlocks, int16_t timePrec, b
...
@@ -570,8 +568,11 @@ int tsParseOneRow(char **str, STableDataBlocks *pDataBlocks, int16_t timePrec, b
// 4. perform the convert
// 4. perform the convert
if
(
isNeedConvertRow
)
{
if
(
isNeedConvertRow
)
{
// put converted row to next location to minimize the memcpy
// put converted row to next location to minimize the memcpy
convertSMemRow
(
row
+
rowSize
,
row
,
pDataBlocks
);
++
(
*
convertIndex
);
*
isConverted
=
true
;
convertSMemRow
(
row
+
(
*
convertIndex
)
*
rowSize
,
row
,
pDataBlocks
);
pDataBlocks
->
ordered
=
false
;
}
else
{
*
convertIndex
=
0
;
}
}
}
}
...
@@ -631,7 +632,7 @@ int32_t tsParseValues(char **str, STableDataBlocks *pDataBlock, int maxRows, SIn
...
@@ -631,7 +632,7 @@ int32_t tsParseValues(char **str, STableDataBlocks *pDataBlock, int maxRows, SIn
pDataBlock
->
boundColumnInfo
.
allNullLen
)))
{
pDataBlock
->
boundColumnInfo
.
allNullLen
)))
{
return
code
;
return
code
;
}
}
bool
isConverted
=
false
;
int32_t
convertIndex
=
0
;
while
(
1
)
{
while
(
1
)
{
index
=
0
;
index
=
0
;
sToken
=
tStrGetToken
(
*
str
,
&
index
,
false
);
sToken
=
tStrGetToken
(
*
str
,
&
index
,
false
);
...
@@ -651,7 +652,7 @@ int32_t tsParseValues(char **str, STableDataBlocks *pDataBlock, int maxRows, SIn
...
@@ -651,7 +652,7 @@ int32_t tsParseValues(char **str, STableDataBlocks *pDataBlock, int maxRows, SIn
maxRows
=
tSize
;
maxRows
=
tSize
;
}
}
code
=
tsParseOneRow
(
str
,
pDataBlock
,
precision
,
&
isConverted
,
extendedRowSize
,
tmpTokenBuf
,
pInsertParam
);
code
=
tsParseOneRow
(
str
,
pDataBlock
,
precision
,
&
convertIndex
,
extendedRowSize
,
tmpTokenBuf
,
pInsertParam
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// error message has been set in tsParseOneRow, return directly
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// error message has been set in tsParseOneRow, return directly
return
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
return
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
}
}
...
@@ -668,9 +669,9 @@ int32_t tsParseValues(char **str, STableDataBlocks *pDataBlock, int maxRows, SIn
...
@@ -668,9 +669,9 @@ int32_t tsParseValues(char **str, STableDataBlocks *pDataBlock, int maxRows, SIn
(
*
numOfRows
)
++
;
(
*
numOfRows
)
++
;
}
}
if
(
isConverted
)
{
if
(
convertIndex
)
{
void
*
convertedSMemRow
=
pDataBlock
->
pData
+
pDataBlock
->
size
;
char
*
convertedSMemRow
=
pDataBlock
->
pData
+
pDataBlock
->
size
;
memcpy
(
POINTER_SHIFT
(
convertedSMemRow
,
-
extendedRowSize
)
,
convertedSMemRow
,
(
size_t
)
memRowTLen
(
convertedSMemRow
));
memcpy
(
convertedSMemRow
-
convertIndex
*
extendedRowSize
,
convertedSMemRow
,
(
size_t
)
memRowTLen
(
convertedSMemRow
));
}
}
if
((
*
numOfRows
)
<=
0
)
{
if
((
*
numOfRows
)
<=
0
)
{
...
@@ -1779,7 +1780,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int32_t numOfRow
...
@@ -1779,7 +1780,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int32_t numOfRow
--
maxRows
;
// 1 more row needed to facilitate the SDataRow/SKVRow convert
--
maxRows
;
// 1 more row needed to facilitate the SDataRow/SKVRow convert
ASSERT
(
maxRows
>
0
);
ASSERT
(
maxRows
>
0
);
bool
isConverted
=
false
;
int32_t
convertIndex
=
0
;
while
((
readLen
=
tgetline
(
&
line
,
&
n
,
fp
))
!=
-
1
)
{
while
((
readLen
=
tgetline
(
&
line
,
&
n
,
fp
))
!=
-
1
)
{
if
((
'\r'
==
line
[
readLen
-
1
])
||
(
'\n'
==
line
[
readLen
-
1
]))
{
if
((
'\r'
==
line
[
readLen
-
1
])
||
(
'\n'
==
line
[
readLen
-
1
]))
{
line
[
--
readLen
]
=
0
;
line
[
--
readLen
]
=
0
;
...
@@ -1792,7 +1793,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int32_t numOfRow
...
@@ -1792,7 +1793,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int32_t numOfRow
char
*
lineptr
=
line
;
char
*
lineptr
=
line
;
strtolower
(
line
,
line
);
strtolower
(
line
,
line
);
code
=
tsParseOneRow
(
&
lineptr
,
pTableDataBlock
,
tinfo
.
precision
,
&
isConverted
,
extendedRowSize
,
tokenBuf
,
code
=
tsParseOneRow
(
&
lineptr
,
pTableDataBlock
,
tinfo
.
precision
,
&
convertIndex
,
extendedRowSize
,
tokenBuf
,
pInsertParam
);
pInsertParam
);
if
(
code
!=
TSDB_CODE_SUCCESS
||
pTableDataBlock
->
numOfParams
>
0
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
||
pTableDataBlock
->
numOfParams
>
0
)
{
pSql
->
res
.
code
=
code
;
pSql
->
res
.
code
=
code
;
...
@@ -1805,9 +1806,9 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int32_t numOfRow
...
@@ -1805,9 +1806,9 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int32_t numOfRow
break
;
break
;
}
}
}
}
if
(
isConverted
)
{
if
(
convertIndex
)
{
void
*
convertedSMemRow
=
pTableDataBlock
->
pData
+
pTableDataBlock
->
size
;
char
*
convertedSMemRow
=
pTableDataBlock
->
pData
+
pTableDataBlock
->
size
;
memcpy
(
POINTER_SHIFT
(
convertedSMemRow
,
-
extendedRowSize
)
,
convertedSMemRow
,
(
size_t
)
memRowTLen
(
convertedSMemRow
));
memcpy
(
convertedSMemRow
-
convertIndex
*
extendedRowSize
,
convertedSMemRow
,
(
size_t
)
memRowTLen
(
convertedSMemRow
));
}
}
tfree
(
tokenBuf
);
tfree
(
tokenBuf
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录