Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9a14e0db
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
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,发现更多精彩内容 >>
提交
9a14e0db
编写于
4月 25, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): fix error in add row into merger.
上级
c6daa68e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
99 addition
and
43 deletion
+99
-43
source/dnode/vnode/src/tsdb/tsdbUtil.c
source/dnode/vnode/src/tsdb/tsdbUtil.c
+99
-43
未找到文件。
source/dnode/vnode/src/tsdb/tsdbUtil.c
浏览文件 @
9a14e0db
...
@@ -712,71 +712,127 @@ _exit:
...
@@ -712,71 +712,127 @@ _exit:
int32_t
tsdbRowMergerAdd
(
SRowMerger
*
pMerger
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
)
{
int32_t
tsdbRowMergerAdd
(
SRowMerger
*
pMerger
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
TSDBKEY
key
=
TSDBROW_KEY
(
pRow
);
TSDBKEY
key
=
TSDBROW_KEY
(
pRow
);
SColVal
*
pColVal
=
&
(
SColVal
){
0
};
SColVal
*
pColVal
=
&
(
SColVal
){
0
};
STColumn
*
pTColumn
;
STColumn
*
pTColumn
;
int32_t
iCol
,
jCol
=
1
;
int32_t
iCol
,
jCol
=
1
;
if
(
NULL
==
pTSchema
)
{
if
(
NULL
==
pTSchema
)
{
pTSchema
=
pMerger
->
pTSchema
;
pTSchema
=
pMerger
->
pTSchema
;
}
}
ASSERT
(((
SColVal
*
)
pMerger
->
pArray
->
pData
)
->
value
.
val
==
key
.
ts
);
for
(
iCol
=
1
;
iCol
<
pMerger
->
pTSchema
->
numOfCols
&&
jCol
<
pTSchema
->
numOfCols
;
++
iCol
)
{
if
(
taosArrayGetSize
(
pMerger
->
pArray
)
==
0
)
{
pTColumn
=
&
pMerger
->
pTSchema
->
columns
[
iCol
];
// ts
if
(
pTSchema
->
columns
[
jCol
].
colId
<
pTColumn
->
colId
)
{
pTColumn
=
&
pTSchema
->
columns
[
jCol
++
];
++
jCol
;
--
iCol
;
ASSERT
(
pTColumn
->
type
==
TSDB_DATA_TYPE_TIMESTAMP
);
continue
;
}
else
if
(
pTSchema
->
columns
[
jCol
].
colId
>
pTColumn
->
colId
)
{
*
pColVal
=
COL_VAL_VALUE
(
pTColumn
->
colId
,
pTColumn
->
type
,
(
SValue
){.
val
=
key
.
ts
});
continue
;
if
(
taosArrayPush
(
pMerger
->
pArray
,
pColVal
)
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
return
code
;
// goto _exit;
}
}
tsdbRowGetColVal
(
pRow
,
pTSchema
,
jCol
++
,
pColVal
);
// other
for
(
iCol
=
1
;
jCol
<
pTSchema
->
numOfCols
&&
iCol
<
pMerger
->
pTSchema
->
numOfCols
;
++
iCol
)
{
pTColumn
=
&
pMerger
->
pTSchema
->
columns
[
iCol
];
if
(
pTSchema
->
columns
[
jCol
].
colId
<
pTColumn
->
colId
)
{
++
jCol
;
--
iCol
;
continue
;
}
else
if
(
pTSchema
->
columns
[
jCol
].
colId
>
pTColumn
->
colId
)
{
taosArrayPush
(
pMerger
->
pArray
,
&
COL_VAL_NONE
(
pTColumn
->
colId
,
pTColumn
->
type
));
continue
;
}
if
(
key
.
version
>
pMerger
->
version
)
{
tsdbRowGetColVal
(
pRow
,
pTSchema
,
jCol
++
,
pColVal
);
if
(
!
COL_VAL_IS_NONE
(
pColVal
))
{
if
((
!
COL_VAL_IS_NONE
(
pColVal
))
&&
(
!
COL_VAL_IS_NULL
(
pColVal
))
&&
IS_VAR_DATA_TYPE
(
pColVal
->
type
))
{
if
(
IS_VAR_DATA_TYPE
(
pColVal
->
type
))
{
uint8_t
*
pVal
=
pColVal
->
value
.
pData
;
SColVal
*
pTColVal
=
taosArrayGet
(
pMerger
->
pArray
,
iCol
);
if
(
!
COL_VAL_IS_NULL
(
pColVal
))
{
code
=
tRealloc
(
&
pTColVal
->
value
.
pData
,
pColVal
->
value
.
nData
);
if
(
code
)
return
code
;
pTColVal
->
value
.
nData
=
pColVal
->
value
.
nData
;
pColVal
->
value
.
pData
=
NULL
;
if
(
pTColVal
->
value
.
nData
)
{
code
=
tRealloc
(
&
pColVal
->
value
.
pData
,
pColVal
->
value
.
nData
);
memcpy
(
pTColVal
->
value
.
pData
,
pColVal
->
value
.
pData
,
pTColVal
->
value
.
nData
);
if
(
code
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
if
(
pColVal
->
value
.
nData
)
{
memcpy
(
pColVal
->
value
.
pData
,
pVal
,
pColVal
->
value
.
nData
);
}
}
if
(
taosArrayPush
(
pMerger
->
pArray
,
pColVal
)
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
return
code
;
}
}
for
(;
iCol
<
pMerger
->
pTSchema
->
numOfCols
;
++
iCol
)
{
pTColumn
=
&
pMerger
->
pTSchema
->
columns
[
iCol
];
taosArrayPush
(
pMerger
->
pArray
,
&
COL_VAL_NONE
(
pTColumn
->
colId
,
pTColumn
->
type
));
}
pMerger
->
version
=
key
.
version
;
return
0
;
}
else
{
ASSERT
(((
SColVal
*
)
pMerger
->
pArray
->
pData
)
->
value
.
val
==
key
.
ts
);
for
(
iCol
=
1
;
iCol
<
pMerger
->
pTSchema
->
numOfCols
&&
jCol
<
pTSchema
->
numOfCols
;
++
iCol
)
{
pTColumn
=
&
pMerger
->
pTSchema
->
columns
[
iCol
];
if
(
pTSchema
->
columns
[
jCol
].
colId
<
pTColumn
->
colId
)
{
++
jCol
;
--
iCol
;
continue
;
}
else
if
(
pTSchema
->
columns
[
jCol
].
colId
>
pTColumn
->
colId
)
{
continue
;
}
tsdbRowGetColVal
(
pRow
,
pTSchema
,
jCol
++
,
pColVal
);
if
(
key
.
version
>
pMerger
->
version
)
{
if
(
!
COL_VAL_IS_NONE
(
pColVal
))
{
if
(
IS_VAR_DATA_TYPE
(
pColVal
->
type
))
{
SColVal
*
pTColVal
=
taosArrayGet
(
pMerger
->
pArray
,
iCol
);
if
(
!
COL_VAL_IS_NULL
(
pColVal
))
{
code
=
tRealloc
(
&
pTColVal
->
value
.
pData
,
pColVal
->
value
.
nData
);
if
(
code
)
return
code
;
pTColVal
->
value
.
nData
=
pColVal
->
value
.
nData
;
if
(
pTColVal
->
value
.
nData
)
{
memcpy
(
pTColVal
->
value
.
pData
,
pColVal
->
value
.
pData
,
pTColVal
->
value
.
nData
);
}
pTColVal
->
flag
=
0
;
}
else
{
tFree
(
pTColVal
->
value
.
pData
);
taosArraySet
(
pMerger
->
pArray
,
iCol
,
pColVal
);
}
}
pTColVal
->
flag
=
0
;
}
else
{
}
else
{
tFree
(
pTColVal
->
value
.
pData
);
taosArraySet
(
pMerger
->
pArray
,
iCol
,
pColVal
);
taosArraySet
(
pMerger
->
pArray
,
iCol
,
pColVal
);
}
}
}
else
{
taosArraySet
(
pMerger
->
pArray
,
iCol
,
pColVal
);
}
}
}
}
else
if
(
key
.
version
<
pMerger
->
version
)
{
}
else
if
(
key
.
version
<
pMerger
->
version
)
{
SColVal
*
tColVal
=
(
SColVal
*
)
taosArrayGet
(
pMerger
->
pArray
,
iCol
);
SColVal
*
tColVal
=
(
SColVal
*
)
taosArrayGet
(
pMerger
->
pArray
,
iCol
);
if
(
COL_VAL_IS_NONE
(
tColVal
)
&&
!
COL_VAL_IS_NONE
(
pColVal
))
{
if
(
COL_VAL_IS_NONE
(
tColVal
)
&&
!
COL_VAL_IS_NONE
(
pColVal
))
{
if
((
!
COL_VAL_IS_NULL
(
pColVal
))
&&
IS_VAR_DATA_TYPE
(
pColVal
->
type
))
{
if
((
!
COL_VAL_IS_NULL
(
pColVal
))
&&
IS_VAR_DATA_TYPE
(
pColVal
->
type
))
{
code
=
tRealloc
(
&
tColVal
->
value
.
pData
,
pColVal
->
value
.
nData
);
code
=
tRealloc
(
&
tColVal
->
value
.
pData
,
pColVal
->
value
.
nData
);
if
(
code
)
return
code
;
if
(
code
)
return
code
;
tColVal
->
value
.
nData
=
pColVal
->
value
.
nData
;
tColVal
->
value
.
nData
=
pColVal
->
value
.
nData
;
if
(
pColVal
->
value
.
nData
)
{
if
(
pColVal
->
value
.
nData
)
{
memcpy
(
tColVal
->
value
.
pData
,
pColVal
->
value
.
pData
,
pColVal
->
value
.
nData
);
memcpy
(
tColVal
->
value
.
pData
,
pColVal
->
value
.
pData
,
pColVal
->
value
.
nData
);
}
tColVal
->
flag
=
0
;
}
else
{
taosArraySet
(
pMerger
->
pArray
,
iCol
,
pColVal
);
}
}
tColVal
->
flag
=
0
;
}
else
{
taosArraySet
(
pMerger
->
pArray
,
iCol
,
pColVal
);
}
}
}
else
{
ASSERT
(
0
&&
"dup versions not allowed"
);
}
}
}
else
{
ASSERT
(
0
&&
"dup versions not allowed"
);
}
}
}
pMerger
->
version
=
key
.
version
;
pMerger
->
version
=
key
.
version
;
return
code
;
return
code
;
}
}
}
int32_t
tsdbRowMergerInit_rv
(
SRowMerger
*
pMerger
,
STSchema
*
pSchema
)
{
int32_t
tsdbRowMergerInit_rv
(
SRowMerger
*
pMerger
,
STSchema
*
pSchema
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录