Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7836b581
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
7836b581
编写于
8月 11, 2022
作者:
5
54liuyao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(stream): delete result
上级
a28c0781
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
14 deletion
+16
-14
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+1
-2
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+15
-12
未找到文件。
source/libs/executor/inc/executorimpl.h
浏览文件 @
7836b581
...
...
@@ -694,6 +694,7 @@ typedef struct SSessionAggOperatorInfo {
typedef
struct
SResultWindowInfo
{
SResultRowPosition
pos
;
STimeWindow
win
;
uint64_t
groupId
;
bool
isOutput
;
bool
isClosed
;
}
SResultWindowInfo
;
...
...
@@ -1008,8 +1009,6 @@ SResultWindowInfo* getSessionTimeWindow(SStreamAggSupporter* pAggSup, TSKEY star
SResultWindowInfo
*
getCurSessionWindow
(
SStreamAggSupporter
*
pAggSup
,
TSKEY
startTs
,
TSKEY
endTs
,
uint64_t
groupId
,
int64_t
gap
,
int32_t
*
pIndex
);
bool
isInTimeWindow
(
STimeWindow
*
pWin
,
TSKEY
ts
,
int64_t
gap
);
int32_t
updateSessionWindowInfo
(
SResultWindowInfo
*
pWinInfo
,
TSKEY
*
pStartTs
,
TSKEY
*
pEndTs
,
int32_t
rows
,
int32_t
start
,
int64_t
gap
,
SHashObj
*
pStDeleted
);
bool
functionNeedToExecute
(
SqlFunctionCtx
*
pCtx
);
bool
isOverdue
(
TSKEY
ts
,
STimeWindowAggSupp
*
pSup
);
bool
isCloseWindow
(
STimeWindow
*
pWin
,
STimeWindowAggSupp
*
pSup
);
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
7836b581
...
...
@@ -3734,7 +3734,7 @@ SResultWindowInfo* getSessionTimeWindow(SStreamAggSupporter* pAggSup, TSKEY star
return
insertNewSessionWindow
(
pWinInfos
,
startTs
,
index
+
1
);
}
int32_t
updateSessionWindowInfo
(
SResultWindowInfo
*
pWinInfo
,
TSKEY
*
pStartTs
,
TSKEY
*
pEndTs
,
int32_t
rows
,
int32_t
updateSessionWindowInfo
(
SResultWindowInfo
*
pWinInfo
,
TSKEY
*
pStartTs
,
TSKEY
*
pEndTs
,
uint64_t
groupId
,
int32_t
rows
,
int32_t
start
,
int64_t
gap
,
SHashObj
*
pStDeleted
)
{
for
(
int32_t
i
=
start
;
i
<
rows
;
++
i
)
{
if
(
!
isInWindow
(
pWinInfo
,
pStartTs
[
i
],
gap
)
&&
(
!
pEndTs
||
!
isInWindow
(
pWinInfo
,
pEndTs
[
i
],
gap
)))
{
...
...
@@ -3742,7 +3742,8 @@ int32_t updateSessionWindowInfo(SResultWindowInfo* pWinInfo, TSKEY* pStartTs, TS
}
if
(
pWinInfo
->
win
.
skey
>
pStartTs
[
i
])
{
if
(
pStDeleted
&&
pWinInfo
->
isOutput
)
{
taosHashPut
(
pStDeleted
,
&
pWinInfo
->
pos
,
sizeof
(
SResultRowPosition
),
&
pWinInfo
->
win
.
skey
,
sizeof
(
TSKEY
));
SWinRes
res
=
{.
ts
=
pWinInfo
->
win
.
skey
,
.
groupId
=
groupId
};
taosHashPut
(
pStDeleted
,
&
pWinInfo
->
pos
,
sizeof
(
SResultRowPosition
),
&
res
,
sizeof
(
SWinRes
));
pWinInfo
->
isOutput
=
false
;
}
pWinInfo
->
win
.
skey
=
pStartTs
[
i
];
...
...
@@ -3861,7 +3862,8 @@ void compactTimeWindow(SStreamSessionAggOperatorInfo* pInfo, int32_t startIndex,
compactFunctions
(
pSup
->
pCtx
,
pInfo
->
pDummyCtx
,
numOfOutput
,
pTaskInfo
);
taosHashRemove
(
pStUpdated
,
&
pWinInfo
->
pos
,
sizeof
(
SResultRowPosition
));
if
(
pWinInfo
->
isOutput
)
{
taosHashPut
(
pStDeleted
,
&
pWinInfo
->
pos
,
sizeof
(
SResultRowPosition
),
&
pWinInfo
->
win
.
skey
,
sizeof
(
TSKEY
));
SWinRes
res
=
{.
ts
=
pWinInfo
->
win
.
skey
,
.
groupId
=
groupId
};
taosHashPut
(
pStDeleted
,
&
pWinInfo
->
pos
,
sizeof
(
SResultRowPosition
),
&
res
,
sizeof
(
SWinRes
));
pWinInfo
->
isOutput
=
false
;
}
taosArrayRemove
(
pInfo
->
streamAggSup
.
pCurWins
,
i
);
...
...
@@ -3911,7 +3913,7 @@ static void doStreamSessionAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSData
int32_t
winIndex
=
0
;
SResultWindowInfo
*
pCurWin
=
getSessionTimeWindow
(
pAggSup
,
startTsCols
[
i
],
endTsCols
[
i
],
groupId
,
gap
,
&
winIndex
);
winRows
=
updateSessionWindowInfo
(
pCurWin
,
startTsCols
,
endTsCols
,
pSDataBlock
->
info
.
rows
,
i
,
pInfo
->
gap
,
pStDeleted
);
updateSessionWindowInfo
(
pCurWin
,
startTsCols
,
endTsCols
,
groupId
,
pSDataBlock
->
info
.
rows
,
i
,
pInfo
->
gap
,
pStDeleted
);
code
=
doOneWindowAgg
(
pInfo
,
pSDataBlock
,
pCurWin
,
&
pResult
,
i
,
winRows
,
numOfOutput
,
pOperator
);
if
(
code
!=
TSDB_CODE_SUCCESS
||
pResult
==
NULL
)
{
longjmp
(
pTaskInfo
->
env
,
TSDB_CODE_QRY_OUT_OF_MEMORY
);
...
...
@@ -3960,6 +3962,7 @@ static void doDeleteTimeWindows(SStreamAggSupporter* pAggSup, SSDataBlock* pBloc
}
deleteWindow
(
pAggSup
->
pCurWins
,
winIndex
,
fp
);
if
(
result
)
{
pCurWin
->
groupId
=
gpDatas
[
i
];
taosArrayPush
(
result
,
pCurWin
);
}
}
...
...
@@ -3980,7 +3983,7 @@ static void doClearSessionWindows(SStreamAggSupporter* pAggSup, SExprSupp* pSup,
step
=
1
;
continue
;
}
step
=
updateSessionWindowInfo
(
pCurWin
,
tsCols
,
NULL
,
pBlock
->
info
.
rows
,
i
,
gap
,
NULL
);
step
=
updateSessionWindowInfo
(
pCurWin
,
tsCols
,
NULL
,
0
,
pBlock
->
info
.
rows
,
i
,
gap
,
NULL
);
ASSERT
(
isInWindow
(
pCurWin
,
tsCols
[
i
],
gap
));
doClearWindowImpl
(
&
pCurWin
->
pos
,
pAggSup
->
pResultBuf
,
pSup
,
numOfOutput
);
if
(
result
)
{
...
...
@@ -4017,12 +4020,11 @@ void doBuildDeleteDataBlock(SHashObj* pStDeleted, SSDataBlock* pBlock, void** It
blockDataEnsureCapacity
(
pBlock
,
size
);
size_t
keyLen
=
0
;
while
(((
*
Ite
)
=
taosHashIterate
(
pStDeleted
,
*
Ite
))
!=
NULL
)
{
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
START_TS_COLUMN_INDEX
);
colDataAppend
(
pColInfoData
,
pBlock
->
info
.
rows
,
*
Ite
,
false
);
for
(
int32_t
i
=
1
;
i
<
taosArrayGetSize
(
pBlock
->
pDataBlock
);
i
++
)
{
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
colDataAppendNULL
(
pColInfoData
,
pBlock
->
info
.
rows
);
}
SWinRes
*
res
=
*
Ite
;
SColumnInfoData
*
pTsCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
START_TS_COLUMN_INDEX
);
colDataAppend
(
pTsCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
&
res
->
ts
,
false
);
SColumnInfoData
*
pGpCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
GROUPID_COLUMN_INDEX
);
colDataAppend
(
pGpCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
&
res
->
groupId
,
false
);
pBlock
->
info
.
rows
+=
1
;
if
(
pBlock
->
info
.
rows
+
1
>=
pBlock
->
info
.
capacity
)
{
break
;
...
...
@@ -4149,7 +4151,8 @@ static void copyDeleteWindowInfo(SArray* pResWins, SHashObj* pStDeleted) {
int32_t
size
=
taosArrayGetSize
(
pResWins
);
for
(
int32_t
i
=
0
;
i
<
size
;
i
++
)
{
SResultWindowInfo
*
pWinInfo
=
taosArrayGet
(
pResWins
,
i
);
taosHashPut
(
pStDeleted
,
&
pWinInfo
->
pos
,
sizeof
(
SResultRowPosition
),
&
pWinInfo
->
win
.
skey
,
sizeof
(
TSKEY
));
SWinRes
res
=
{.
ts
=
pWinInfo
->
win
.
skey
,
.
groupId
=
pWinInfo
->
groupId
};
taosHashPut
(
pStDeleted
,
&
pWinInfo
->
pos
,
sizeof
(
SResultRowPosition
),
&
res
,
sizeof
(
SWinRes
));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录