Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
619d9712
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
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,发现更多精彩内容 >>
未验证
提交
619d9712
编写于
8月 19, 2021
作者:
H
Hongze Cheng
提交者:
GitHub
8月 19, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7460 from taosdata/enhance/TD-6184-D
[TD-6184]<enhance>: optimize insert from imported file
上级
49925ccc
021fc6af
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
8 addition
and
20 deletion
+8
-20
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+3
-5
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+5
-15
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
619d9712
...
...
@@ -123,17 +123,15 @@ typedef struct {
int32_t
kvLen
;
// len of SKVRow
}
SMemRowInfo
;
typedef
struct
{
uint8_t
memRowType
;
uint8_t
compareStat
;
// 0 unknown, 1 need compare, 2 no need
TDRowTLenT
dataRowInitLen
;
uint8_t
memRowType
;
// default is 0, that is SDataRow
uint8_t
compareStat
;
// 0 no need, 1 need compare
TDRowTLenT
kvRowInitLen
;
SMemRowInfo
*
rowInfo
;
}
SMemRowBuilder
;
typedef
enum
{
ROW_COMPARE_
UNKNOWN
=
0
,
ROW_COMPARE_
NO_NEED
=
0
,
ROW_COMPARE_NEED
=
1
,
ROW_COMPARE_NO_NEED
=
2
,
}
ERowCompareStat
;
int
tsParseTime
(
SStrToken
*
pToken
,
int64_t
*
time
,
char
**
next
,
char
*
error
,
int16_t
timePrec
);
...
...
src/client/src/tscParseInsert.c
浏览文件 @
619d9712
...
...
@@ -51,20 +51,18 @@ int initMemRowBuilder(SMemRowBuilder *pBuilder, uint32_t nRows, uint3
}
}
// default compareStat is ROW_COMPARE_NO_NEED
if
(
nBoundCols
==
0
)
{
// file input
pBuilder
->
memRowType
=
SMEM_ROW_DATA
;
pBuilder
->
compareStat
=
ROW_COMPARE_NO_NEED
;
return
TSDB_CODE_SUCCESS
;
}
else
{
float
boundRatio
=
((
float
)
nBoundCols
/
(
float
)
nCols
);
if
(
boundRatio
<
KVRatioKV
)
{
pBuilder
->
memRowType
=
SMEM_ROW_KV
;
pBuilder
->
compareStat
=
ROW_COMPARE_NO_NEED
;
return
TSDB_CODE_SUCCESS
;
}
else
if
(
boundRatio
>
KVRatioData
)
{
pBuilder
->
memRowType
=
SMEM_ROW_DATA
;
pBuilder
->
compareStat
=
ROW_COMPARE_NO_NEED
;
return
TSDB_CODE_SUCCESS
;
}
pBuilder
->
compareStat
=
ROW_COMPARE_NEED
;
...
...
@@ -76,7 +74,6 @@ int initMemRowBuilder(SMemRowBuilder *pBuilder, uint32_t nRows, uint3
}
}
pBuilder
->
dataRowInitLen
=
TD_MEM_ROW_DATA_HEAD_SIZE
+
allNullLen
;
pBuilder
->
kvRowInitLen
=
TD_MEM_ROW_KV_HEAD_SIZE
+
nBoundCols
*
sizeof
(
SColIdx
);
if
(
nRows
>
0
)
{
...
...
@@ -86,7 +83,7 @@ int initMemRowBuilder(SMemRowBuilder *pBuilder, uint32_t nRows, uint3
}
for
(
int
i
=
0
;
i
<
nRows
;
++
i
)
{
(
pBuilder
->
rowInfo
+
i
)
->
dataLen
=
pBuilder
->
dataRowInit
Len
;
(
pBuilder
->
rowInfo
+
i
)
->
dataLen
=
TD_MEM_ROW_DATA_HEAD_SIZE
+
allNull
Len
;
(
pBuilder
->
rowInfo
+
i
)
->
kvLen
=
pBuilder
->
kvRowInitLen
;
}
}
...
...
@@ -460,7 +457,7 @@ int tsParseOneRow(char **str, STableDataBlocks *pDataBlocks, int16_t timePrec, i
STableMeta
*
pTableMeta
=
pDataBlocks
->
pTableMeta
;
SSchema
*
schema
=
tscGetTableSchema
(
pTableMeta
);
SMemRowBuilder
*
pBuilder
=
&
pDataBlocks
->
rowBuilder
;
int32_t
dataLen
=
pBuilder
->
dataRowInitLen
;
int32_t
dataLen
=
spd
->
allNullLen
+
TD_MEM_ROW_DATA_HEAD_SIZE
;
int32_t
kvLen
=
pBuilder
->
kvRowInitLen
;
bool
isParseBindParam
=
false
;
...
...
@@ -809,13 +806,12 @@ int tscSortRemoveDataBlockDupRows(STableDataBlocks *dataBuf, SBlockKeyInfo *pBlk
// allocate memory
size_t
nAlloc
=
nRows
*
sizeof
(
SBlockKeyTuple
);
if
(
pBlkKeyInfo
->
pKeyTuple
==
NULL
||
pBlkKeyInfo
->
maxBytesAlloc
<
nAlloc
)
{
size_t
nRealAlloc
=
nAlloc
+
10
*
sizeof
(
SBlockKeyTuple
);
char
*
tmp
=
trealloc
(
pBlkKeyInfo
->
pKeyTuple
,
nRealAlloc
);
char
*
tmp
=
trealloc
(
pBlkKeyInfo
->
pKeyTuple
,
nAlloc
);
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
pBlkKeyInfo
->
pKeyTuple
=
(
SBlockKeyTuple
*
)
tmp
;
pBlkKeyInfo
->
maxBytesAlloc
=
(
int32_t
)
n
Real
Alloc
;
pBlkKeyInfo
->
maxBytesAlloc
=
(
int32_t
)
nAlloc
;
}
memset
(
pBlkKeyInfo
->
pKeyTuple
,
0
,
nAlloc
);
...
...
@@ -1726,12 +1722,6 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int32_t numOfRow
goto
_error
;
}
if
(
TSDB_CODE_SUCCESS
!=
(
ret
=
initMemRowBuilder
(
&
pTableDataBlock
->
rowBuilder
,
0
,
tinfo
.
numOfColumns
,
pTableDataBlock
->
numOfParams
,
pTableDataBlock
->
boundColumnInfo
.
allNullLen
)))
{
goto
_error
;
}
while
((
readLen
=
tgetline
(
&
line
,
&
n
,
fp
))
!=
-
1
)
{
if
((
'\r'
==
line
[
readLen
-
1
])
||
(
'\n'
==
line
[
readLen
-
1
]))
{
line
[
--
readLen
]
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录