Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
879f9f75
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看板
提交
879f9f75
编写于
7月 01, 2021
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code optimization
上级
0d9cf348
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
38 addition
and
40 deletion
+38
-40
src/common/src/tdataformat.c
src/common/src/tdataformat.c
+38
-40
未找到文件。
src/common/src/tdataformat.c
浏览文件 @
879f9f75
...
@@ -475,37 +475,37 @@ static void tdAppendDataRowToDataCol(SDataRow row, STSchema *pSchema, SDataCols
...
@@ -475,37 +475,37 @@ static void tdAppendDataRowToDataCol(SDataRow row, STSchema *pSchema, SDataCols
pCols
->
numOfRows
++
;
pCols
->
numOfRows
++
;
}
}
static
void
tdGetKVRowColInfo
(
const
STSchema
*
pSchema
,
SColIdx
*
pColIdx
,
int
nRowCols
,
STColumn
*
pSTColumn
,
//
static void tdGetKVRowColInfo(const STSchema *pSchema, SColIdx *pColIdx, int nRowCols, STColumn *pSTColumn,
int
*
nColMatched
)
{
//
int *nColMatched) {
int
nSchema
=
schemaNCols
(
pSchema
);
//
int nSchema = schemaNCols(pSchema);
int
iCol
=
0
;
//
int iCol = 0;
int
iSchema
=
0
;
//
int iSchema = 0;
int
nColMatch
=
0
;
//
int nColMatch = 0;
SColIdx
*
pIdx
=
pColIdx
;
//
SColIdx * pIdx = pColIdx;
const
STColumn
*
pColumn
=
NULL
;
//
const STColumn *pColumn = NULL;
while
(
iCol
<
nRowCols
&&
iSchema
<
nSchema
)
{
//
while (iCol < nRowCols && iSchema < nSchema) {
pColumn
=
&
pSchema
->
columns
[
iSchema
];
//
pColumn = &pSchema->columns[iSchema];
if
(
pIdx
->
colId
==
pColumn
->
colId
)
{
//
if (pIdx->colId == pColumn->colId) {
pSTColumn
[
nColMatch
].
colId
=
pIdx
->
colId
;
//
pSTColumn[nColMatch].colId = pIdx->colId;
pSTColumn
[
nColMatch
].
type
=
pColumn
->
type
;
//
pSTColumn[nColMatch].type = pColumn->type;
pSTColumn
[
nColMatch
].
bytes
=
pColumn
->
bytes
;
//
pSTColumn[nColMatch].bytes = pColumn->bytes;
pSTColumn
[
nColMatch
].
offset
=
pIdx
->
offset
;
//
pSTColumn[nColMatch].offset = pIdx->offset;
pIdx
+=
sizeof
(
SColIdx
);
//
pIdx += sizeof(SColIdx);
++
iCol
;
//
++iCol;
++
iSchema
;
//
++iSchema;
++
nColMatch
;
//
++nColMatch;
}
else
if
(
pIdx
->
colId
>
pColumn
->
colId
)
{
//
} else if (pIdx->colId > pColumn->colId) {
++
iSchema
;
//
++iSchema;
}
else
{
//
} else {
pIdx
+=
sizeof
(
SColIdx
);
//
pIdx += sizeof(SColIdx);
++
iCol
;
//
++iCol;
}
//
}
}
//
}
*
nColMatched
=
nColMatch
;
//
*nColMatched = nColMatch;
}
//
}
static
void
tdAppendKvRowToDataCol
(
SKVRow
row
,
STSchema
*
pSchema
,
SDataCols
*
pCols
)
{
static
void
tdAppendKvRowToDataCol
(
SKVRow
row
,
STSchema
*
pSchema
,
SDataCols
*
pCols
)
{
ASSERT
(
pCols
->
numOfRows
==
0
||
dataColsKeyLast
(
pCols
)
<
kvRowKey
(
row
));
ASSERT
(
pCols
->
numOfRows
==
0
||
dataColsKeyLast
(
pCols
)
<
kvRowKey
(
row
));
...
@@ -524,15 +524,15 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo
...
@@ -524,15 +524,15 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo
}
}
}
else
{
}
else
{
int
nRowCols
=
kvRowNCols
(
row
);
int
nRowCols
=
kvRowNCols
(
row
);
int
nRowColsMatched
=
0
;
//
int nRowColsMatched = 0;
STColumn
stColumn
[
nRowCols
];
//
STColumn stColumn[nRowCols];
tdGetKVRowColInfo
(
pSchema
,
kvRowColIdx
(
row
),
nRowCols
,
stColumn
,
&
nRowColsMatched
);
//
tdGetKVRowColInfo(pSchema, kvRowColIdx(row), nRowCols, stColumn, &nRowColsMatched);
uDebug
(
"prop:kvRow: nRowCols=%d, nRowColsMatched=%d, nSchemaCols=%d"
,
nRowCols
,
nRowColsMatched
,
// uInfo
("prop:kvRow: nRowCols=%d, nRowColsMatched=%d, nSchemaCols=%d", nRowCols, nRowColsMatched,
schemaNCols
(
pSchema
));
//
schemaNCols(pSchema));
while
(
dcol
<
pCols
->
numOfCols
)
{
while
(
dcol
<
pCols
->
numOfCols
)
{
SDataCol
*
pDataCol
=
&
(
pCols
->
cols
[
dcol
]);
SDataCol
*
pDataCol
=
&
(
pCols
->
cols
[
dcol
]);
if
(
rcol
>=
nRowCols
Matched
||
rcol
>=
schemaNCols
(
pSchema
))
{
if
(
rcol
>=
nRowCols
||
rcol
>=
schemaNCols
(
pSchema
))
{
dataColAppendVal
(
pDataCol
,
tdGetNullVal
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
);
dataColAppendVal
(
pDataCol
,
tdGetNullVal
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
);
dcol
++
;
dcol
++
;
continue
;
continue
;
...
@@ -541,9 +541,7 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo
...
@@ -541,9 +541,7 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo
SColIdx
*
colIdx
=
kvRowColIdxAt
(
row
,
rcol
);
SColIdx
*
colIdx
=
kvRowColIdxAt
(
row
,
rcol
);
if
(
colIdx
->
colId
==
pDataCol
->
colId
)
{
if
(
colIdx
->
colId
==
pDataCol
->
colId
)
{
ASSERT
(
pDataCol
->
type
==
stColumn
[
rcol
].
type
);
void
*
value
=
tdGetKvRowDataOfCol
(
row
,
pDataCol
->
type
,
colIdx
->
offset
);
void
*
value
=
tdGetKvRowDataOfCol
(
row
,
pDataCol
->
type
,
stColumn
[
rcol
].
offset
+
TD_KV_ROW_HEAD_SIZE
);
dataColAppendVal
(
pDataCol
,
value
,
pCols
->
numOfRows
,
pCols
->
maxPoints
);
dataColAppendVal
(
pDataCol
,
value
,
pCols
->
numOfRows
,
pCols
->
maxPoints
);
dcol
++
;
dcol
++
;
rcol
++
;
rcol
++
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录