Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c038848f
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看板
提交
c038848f
编写于
6月 10, 2022
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature: output results in merge-interval agg buf when exhausted input stream
上级
433286c0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
33 deletion
+49
-33
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+1
-0
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+48
-33
未找到文件。
source/libs/executor/src/executorimpl.c
浏览文件 @
c038848f
...
...
@@ -2002,6 +2002,7 @@ int32_t finalizeResultRowIntoResultDataBlock(SDiskbasedBuf* pBuf, SResultRowPosi
}
releaseBufPage
(
pBuf
,
page
);
pBlock
->
info
.
rows
+=
pRow
->
numOfRows
;
return
0
;
}
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
c038848f
...
...
@@ -3202,6 +3202,7 @@ typedef struct SMergeIntervalAggOperatorInfo {
bool
hasGroupId
;
uint64_t
groupId
;
SSDataBlock
*
prefetchedBlock
;
bool
inputBlocksFinished
;
}
SMergeIntervalAggOperatorInfo
;
void
destroyMergeIntervalOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
...
...
@@ -3223,7 +3224,7 @@ static int32_t outputPrevIntervalResult(SOperatorInfo* pOperatorInfo, uint64_t t
return
0
;
}
if
(
ascScan
&&
newWin
->
skey
>
prevWin
->
ekey
||
(
!
ascScan
)
&&
newWin
->
skey
<
prevWin
->
ekey
)
{
if
(
newWin
==
NULL
||
(
ascScan
&&
newWin
->
skey
>
prevWin
->
ekey
||
(
!
ascScan
)
&&
newWin
->
skey
<
prevWin
->
ekey
)
)
{
SET_RES_WINDOW_KEY
(
iaInfo
->
aggSup
.
keyBuf
,
&
prevWin
->
skey
,
TSDB_KEYSIZE
,
tableGroupId
);
SResultRowPosition
*
p1
=
(
SResultRowPosition
*
)
taosHashGet
(
iaInfo
->
aggSup
.
pResultRowHashTable
,
iaInfo
->
aggSup
.
keyBuf
,
GET_RES_WINDOW_KEY_LEN
(
TSDB_KEYSIZE
));
...
...
@@ -3233,9 +3234,13 @@ static int32_t outputPrevIntervalResult(SOperatorInfo* pOperatorInfo, uint64_t t
pOperatorInfo
->
numOfExprs
,
iaInfo
->
binfo
.
rowCellInfoOffset
,
pResultBlock
,
pTaskInfo
);
taosHashRemove
(
iaInfo
->
aggSup
.
pResultRowHashTable
,
iaInfo
->
aggSup
.
keyBuf
,
GET_RES_WINDOW_KEY_LEN
(
TSDB_KEYSIZE
));
taosHashPut
(
miaInfo
->
groupIntervalHash
,
&
tableGroupId
,
sizeof
(
tableGroupId
),
newWin
,
sizeof
(
STimeWindow
));
if
(
newWin
==
NULL
)
{
taosHashRemove
(
miaInfo
->
groupIntervalHash
,
&
tableGroupId
,
sizeof
(
tableGroupId
));
}
else
{
taosHashPut
(
miaInfo
->
groupIntervalHash
,
&
tableGroupId
,
sizeof
(
tableGroupId
),
newWin
,
sizeof
(
STimeWindow
));
}
}
return
0
;
}
...
...
@@ -3343,47 +3348,57 @@ static SSDataBlock* doMergeIntervalAgg(SOperatorInfo* pOperator) {
SSDataBlock
*
pRes
=
iaInfo
->
binfo
.
pRes
;
blockDataCleanup
(
pRes
);
blockDataEnsureCapacity
(
pRes
,
pOperator
->
resultInfo
.
capacity
);
SOperatorInfo
*
downstream
=
pOperator
->
pDownstream
[
0
];
int32_t
scanFlag
=
MAIN_SCAN
;
while
(
1
)
{
SSDataBlock
*
pBlock
=
NULL
;
if
(
miaInfo
->
prefetchedBlock
==
NULL
)
{
pBlock
=
downstream
->
fpSet
.
getNextFn
(
downstream
);
}
else
{
pBlock
=
miaInfo
->
prefetchedBlock
;
miaInfo
->
groupId
=
pBlock
->
info
.
groupId
;
}
if
(
!
miaInfo
->
inputBlocksFinished
)
{
SOperatorInfo
*
downstream
=
pOperator
->
pDownstream
[
0
];
int32_t
scanFlag
=
MAIN_SCAN
;
while
(
1
)
{
SSDataBlock
*
pBlock
=
NULL
;
if
(
miaInfo
->
prefetchedBlock
==
NULL
)
{
pBlock
=
downstream
->
fpSet
.
getNextFn
(
downstream
);
}
else
{
pBlock
=
miaInfo
->
prefetchedBlock
;
miaInfo
->
groupId
=
pBlock
->
info
.
groupId
;
}
if
(
pBlock
==
NULL
)
{
break
;
}
if
(
pBlock
==
NULL
)
{
miaInfo
->
inputBlocksFinished
=
true
;
break
;
}
if
(
!
miaInfo
->
hasGroupId
)
{
miaInfo
->
hasGroupId
=
true
;
miaInfo
->
groupId
=
pBlock
->
info
.
groupId
;
}
else
if
(
miaInfo
->
groupId
!=
pBlock
->
info
.
groupId
)
{
miaInfo
->
prefetchedBlock
=
pBlock
;
break
;
}
if
(
!
miaInfo
->
hasGroupId
)
{
miaInfo
->
hasGroupId
=
true
;
miaInfo
->
groupId
=
pBlock
->
info
.
groupId
;
}
else
if
(
miaInfo
->
groupId
!=
pBlock
->
info
.
groupId
)
{
miaInfo
->
prefetchedBlock
=
pBlock
;
break
;
}
getTableScanInfo
(
pOperator
,
&
iaInfo
->
order
,
&
scanFlag
);
setInputDataBlock
(
pOperator
,
iaInfo
->
binfo
.
pCtx
,
pBlock
,
iaInfo
->
order
,
scanFlag
,
true
);
STableQueryInfo
*
pTableQueryInfo
=
iaInfo
->
pCurrent
;
getTableScanInfo
(
pOperator
,
&
iaInfo
->
order
,
&
scanFlag
);
setInputDataBlock
(
pOperator
,
iaInfo
->
binfo
.
pCtx
,
pBlock
,
iaInfo
->
order
,
scanFlag
,
true
);
STableQueryInfo
*
pTableQueryInfo
=
iaInfo
->
pCurrent
;
setIntervalQueryRange
(
pTableQueryInfo
,
pBlock
->
info
.
window
.
skey
,
&
pTaskInfo
->
window
);
doMergeIntervalAggImpl
(
pOperator
,
&
iaInfo
->
binfo
.
resultRowInfo
,
pBlock
,
scanFlag
,
pRes
);
setIntervalQueryRange
(
pTableQueryInfo
,
pBlock
->
info
.
window
.
skey
,
&
pTaskInfo
->
window
);
doMergeIntervalAggImpl
(
pOperator
,
&
iaInfo
->
binfo
.
resultRowInfo
,
pBlock
,
scanFlag
,
pRes
);
if
(
pRes
->
info
.
rows
>=
pOperator
->
resultInfo
.
threshold
)
{
break
;
if
(
pRes
->
info
.
rows
>=
pOperator
->
resultInfo
.
threshold
)
{
break
;
}
}
pRes
->
info
.
groupId
=
miaInfo
->
groupId
;
}
else
{
void
*
p
=
taosHashIterate
(
miaInfo
->
groupIntervalHash
,
NULL
);
if
(
p
!=
NULL
)
{
size_t
len
=
0
;
uint64_t
*
pKey
=
taosHashGetKey
(
p
,
&
len
);
outputPrevIntervalResult
(
pOperator
,
*
pKey
,
pRes
,
NULL
);
}
}
pRes
->
info
.
groupId
=
miaInfo
->
groupId
;
if
(
pRes
->
info
.
rows
==
0
)
{
doSetOperatorCompleted
(
pOperator
);
}
else
{
blockDataUpdateTsWindow
(
pRes
,
0
);
}
size_t
rows
=
pRes
->
info
.
rows
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录