Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d2ed6ff0
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看板
提交
d2ed6ff0
编写于
8月 29, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): set correct page buffer id.
上级
ba8b10e2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
20 deletion
+18
-20
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+7
-5
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+10
-14
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+1
-1
未找到文件。
source/libs/executor/inc/executorimpl.h
浏览文件 @
d2ed6ff0
...
...
@@ -297,10 +297,11 @@ enum {
};
typedef
struct
SAggSupporter
{
SHashObj
*
pResultRowHashTable
;
// quick locate the window object for each result
char
*
keyBuf
;
// window key buffer
SDiskbasedBuf
*
pResultBuf
;
// query result buffer based on blocked-wised disk file
int32_t
resultRowSize
;
// the result buffer size for each result row, with the meta data size for each row
SHashObj
*
pResultRowHashTable
;
// quick locate the window object for each result
char
*
keyBuf
;
// window key buffer
SDiskbasedBuf
*
pResultBuf
;
// query result buffer based on blocked-wised disk file
int32_t
resultRowSize
;
// the result buffer size for each result row, with the meta data size for each row
int32_t
currentPageId
;
// current write page id
}
SAggSupporter
;
typedef
struct
{
...
...
@@ -429,6 +430,7 @@ typedef struct SStreamAggSupporter {
char
*
pKeyBuf
;
// window key buffer
SDiskbasedBuf
*
pResultBuf
;
// query result buffer based on blocked-wised disk file
int32_t
resultRowSize
;
// the result buffer size for each result row, with the meta data size for each row
int32_t
currentPageId
;
// buffer page that is active
SSDataBlock
*
pScanBlock
;
}
SStreamAggSupporter
;
...
...
@@ -991,7 +993,7 @@ int32_t getNumOfRowsInTimeWindow(SDataBlockInfo* pDataBlockInfo, TSKEY* pPrimary
int32_t
binarySearchForKey
(
char
*
pValue
,
int
num
,
TSKEY
key
,
int
order
);
int32_t
initStreamAggSupporter
(
SStreamAggSupporter
*
pSup
,
const
char
*
pKey
,
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
,
int32_t
size
);
SResultRow
*
getNewResultRow
(
SDiskbasedBuf
*
pResultBuf
,
int
64_t
tableGroup
Id
,
int32_t
interBufSize
);
SResultRow
*
getNewResultRow
(
SDiskbasedBuf
*
pResultBuf
,
int
32_t
*
currentPage
Id
,
int32_t
interBufSize
);
SResultWindowInfo
*
getSessionTimeWindow
(
SStreamAggSupporter
*
pAggSup
,
TSKEY
startTs
,
TSKEY
endTs
,
uint64_t
groupId
,
int64_t
gap
,
int32_t
*
pIndex
);
SResultWindowInfo
*
getCurSessionWindow
(
SStreamAggSupporter
*
pAggSup
,
TSKEY
startTs
,
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
d2ed6ff0
...
...
@@ -179,24 +179,21 @@ static bool chkResultRowFromKey(STaskRuntimeEnv* pRuntimeEnv, SResultRowInfo* pR
}
#endif
SResultRow
*
getNewResultRow
(
SDiskbasedBuf
*
pResultBuf
,
int
64_t
tableGroup
Id
,
int32_t
interBufSize
)
{
SResultRow
*
getNewResultRow
(
SDiskbasedBuf
*
pResultBuf
,
int
32_t
*
currentPage
Id
,
int32_t
interBufSize
)
{
SFilePage
*
pData
=
NULL
;
// in the first scan, new space needed for results
int32_t
pageId
=
-
1
;
SIDList
list
=
getDataBufPagesIdList
(
pResultBuf
);
if
(
taosArrayGetSize
(
list
)
==
0
)
{
if
(
*
currentPageId
==
-
1
)
{
pData
=
getNewBufPage
(
pResultBuf
,
&
pageId
);
pData
->
num
=
sizeof
(
SFilePage
);
}
else
{
SPageInfo
*
pi
=
getLastPageInfo
(
list
);
pData
=
getBufPage
(
pResultBuf
,
getPageId
(
pi
));
pageId
=
getPageId
(
pi
);
pData
=
getBufPage
(
pResultBuf
,
*
currentPageId
);
pageId
=
*
currentPageId
;
if
(
pData
->
num
+
interBufSize
>
getBufPageSize
(
pResultBuf
))
{
// release current page first, and prepare the next one
releaseBufPage
Info
(
pResultBuf
,
pi
);
releaseBufPage
(
pResultBuf
,
pData
);
pData
=
getNewBufPage
(
pResultBuf
,
&
pageId
);
if
(
pData
!=
NULL
)
{
...
...
@@ -215,9 +212,9 @@ SResultRow* getNewResultRow(SDiskbasedBuf* pResultBuf, int64_t tableGroupId, int
SResultRow
*
pResultRow
=
(
SResultRow
*
)((
char
*
)
pData
+
pData
->
num
);
pResultRow
->
pageId
=
pageId
;
pResultRow
->
offset
=
(
int32_t
)
pData
->
num
;
*
currentPageId
=
pageId
;
pData
->
num
+=
interBufSize
;
return
pResultRow
;
}
...
...
@@ -263,11 +260,8 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR
// allocate a new buffer page
if
(
pResult
==
NULL
)
{
#ifdef BUF_PAGE_DEBUG
qDebug
(
"page_2"
);
#endif
ASSERT
(
pSup
->
resultRowSize
>
0
);
pResult
=
getNewResultRow
(
pResultBuf
,
group
Id
,
pSup
->
resultRowSize
);
pResult
=
getNewResultRow
(
pResultBuf
,
&
pSup
->
currentPage
Id
,
pSup
->
resultRowSize
);
initResultRow
(
pResult
);
...
...
@@ -3093,7 +3087,7 @@ int32_t aggDecodeResultRow(SOperatorInfo* pOperator, char* result) {
offset
+=
sizeof
(
int32_t
);
uint64_t
tableGroupId
=
*
(
uint64_t
*
)(
result
+
offset
);
SResultRow
*
resultRow
=
getNewResultRow
(
pSup
->
pResultBuf
,
tableGroup
Id
,
pSup
->
resultRowSize
);
SResultRow
*
resultRow
=
getNewResultRow
(
pSup
->
pResultBuf
,
&
pSup
->
currentPage
Id
,
pSup
->
resultRowSize
);
if
(
!
resultRow
)
{
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
...
...
@@ -3442,6 +3436,7 @@ int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t n
const
char
*
pKey
)
{
_hash_fn_t
hashFn
=
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
);
pAggSup
->
currentPageId
=
-
1
;
pAggSup
->
resultRowSize
=
getResultRowSize
(
pCtx
,
numOfOutput
);
pAggSup
->
keyBuf
=
taosMemoryCalloc
(
1
,
keyBufSize
+
POINTER_BYTES
+
sizeof
(
int64_t
));
pAggSup
->
pResultRowHashTable
=
taosHashInit
(
10
,
hashFn
,
true
,
HASH_NO_LOCK
);
...
...
@@ -4678,6 +4673,7 @@ int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SArray* pExecInf
int32_t
initStreamAggSupporter
(
SStreamAggSupporter
*
pSup
,
const
char
*
pKey
,
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
,
int32_t
size
)
{
pSup
->
currentPageId
=
-
1
;
pSup
->
resultRowSize
=
getResultRowSize
(
pCtx
,
numOfOutput
);
pSup
->
keySize
=
sizeof
(
int64_t
)
+
sizeof
(
TSKEY
);
pSup
->
pKeyBuf
=
taosMemoryCalloc
(
1
,
pSup
->
keySize
);
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
d2ed6ff0
...
...
@@ -3790,7 +3790,7 @@ static int32_t setWindowOutputBuf(SResultWindowInfo* pWinInfo, SResultRow** pRes
}
if
(
pWinInfo
->
pos
.
pageId
==
-
1
)
{
*
pResult
=
getNewResultRow
(
pAggSup
->
pResultBuf
,
group
Id
,
pAggSup
->
resultRowSize
);
*
pResult
=
getNewResultRow
(
pAggSup
->
pResultBuf
,
&
pAggSup
->
currentPage
Id
,
pAggSup
->
resultRowSize
);
if
(
*
pResult
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录