Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
95104645
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
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,发现更多精彩内容 >>
提交
95104645
编写于
11月 02, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-225]<enhance>: optimize the memory consumption for interval query.
上级
5bbd7dd9
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
8 addition
and
14 deletion
+8
-14
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+3
-4
src/query/inc/qUtil.h
src/query/inc/qUtil.h
+1
-2
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+3
-5
src/query/src/qUtil.c
src/query/src/qUtil.c
+1
-3
未找到文件。
src/query/inc/qExecutor.h
浏览文件 @
95104645
...
...
@@ -83,14 +83,13 @@ typedef struct SResultRec {
typedef
struct
SWindowResInfo
{
SResultRow
**
pResult
;
// result list
int16_t
type
;
// data type for hash key
int16_t
type
:
8
;
// data type for hash key
int32_t
size
:
24
;
// number of result set
int32_t
threshold
;
// threshold to halt query and return the generated results.
int32_t
capacity
;
// max capacity
int32_t
curIndex
;
// current start active index
int32_t
size
;
// number of result set
int64_t
startTime
;
// start time of the first time window for sliding query
int64_t
prevSKey
;
// previous (not completed) sliding window start key
int64_t
threshold
;
// threshold to halt query and return the generated results.
int64_t
interval
;
// time window interval
}
SWindowResInfo
;
typedef
struct
SColumnFilterElem
{
...
...
src/query/inc/qUtil.h
浏览文件 @
95104645
...
...
@@ -30,8 +30,7 @@ void clearResultRow(SQueryRuntimeEnv* pRuntimeEnv, SResultRow* pRow);
void
copyResultRow
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SResultRow
*
dst
,
const
SResultRow
*
src
);
SResultRowCellInfo
*
getResultCell
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
const
SResultRow
*
pRow
,
int32_t
index
);
int32_t
initWindowResInfo
(
SWindowResInfo
*
pWindowResInfo
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
size
,
int32_t
threshold
,
int16_t
type
);
int32_t
initWindowResInfo
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
size
,
int32_t
threshold
,
int16_t
type
);
void
cleanupTimeWindowInfo
(
SWindowResInfo
*
pWindowResInfo
);
void
resetTimeWindowInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SWindowResInfo
*
pWindowResInfo
);
...
...
src/query/src/qExecutor.c
浏览文件 @
95104645
...
...
@@ -1136,8 +1136,6 @@ static int32_t setGroupResultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, char *pDat
pWindowRes
->
win
.
ekey
=
v
;
}
assert
(
pRuntimeEnv
->
windowResInfo
.
interval
==
0
);
if
(
pWindowRes
->
pageId
==
-
1
)
{
int32_t
ret
=
addNewWindowResultBuf
(
pWindowRes
,
pResultBuf
,
GROUPRESULTID
,
pRuntimeEnv
->
numOfRowsPerPage
);
if
(
ret
!=
0
)
{
...
...
@@ -3758,7 +3756,7 @@ static STableQueryInfo *createTableQueryInfo(SQueryRuntimeEnv *pRuntimeEnv, void
if
(
QUERY_IS_INTERVAL_QUERY
(
pQuery
)
||
pRuntimeEnv
->
groupbyNormalCol
)
{
int32_t
initialSize
=
16
;
int32_t
initialThreshold
=
100
;
int32_t
code
=
initWindowResInfo
(
&
pTableQueryInfo
->
windowResInfo
,
pRuntimeEnv
,
initialSize
,
initialThreshold
,
TSDB_DATA_TYPE_INT
);
int32_t
code
=
initWindowResInfo
(
&
pTableQueryInfo
->
windowResInfo
,
initialSize
,
initialThreshold
,
TSDB_DATA_TYPE_INT
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
NULL
;
}
...
...
@@ -4623,7 +4621,7 @@ int32_t doInitQInfo(SQInfo *pQInfo, STSBuf *pTsBuf, void *tsdb, int32_t vgId, bo
}
}
code
=
initWindowResInfo
(
&
pRuntimeEnv
->
windowResInfo
,
pRuntimeEnv
,
8
,
threshold
,
type
);
code
=
initWindowResInfo
(
&
pRuntimeEnv
->
windowResInfo
,
8
,
threshold
,
type
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -4643,7 +4641,7 @@ int32_t doInitQInfo(SQInfo *pQInfo, STSBuf *pTsBuf, void *tsdb, int32_t vgId, bo
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
}
code
=
initWindowResInfo
(
&
pRuntimeEnv
->
windowResInfo
,
pRuntimeEnv
,
numOfResultRows
,
4096
,
type
);
code
=
initWindowResInfo
(
&
pRuntimeEnv
->
windowResInfo
,
numOfResultRows
,
1024
,
type
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
src/query/src/qUtil.c
浏览文件 @
95104645
...
...
@@ -31,8 +31,7 @@ int32_t getOutputInterResultBufSize(SQuery* pQuery) {
return
size
;
}
int32_t
initWindowResInfo
(
SWindowResInfo
*
pWindowResInfo
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
size
,
int32_t
threshold
,
int16_t
type
)
{
int32_t
initWindowResInfo
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
size
,
int32_t
threshold
,
int16_t
type
)
{
pWindowResInfo
->
capacity
=
size
;
pWindowResInfo
->
threshold
=
threshold
;
...
...
@@ -46,7 +45,6 @@ int32_t initWindowResInfo(SWindowResInfo *pWindowResInfo, SQueryRuntimeEnv *pRun
return
TSDB_CODE_QRY_OUT_OF_MEMORY
;
}
pWindowResInfo
->
interval
=
pRuntimeEnv
->
pQuery
->
interval
.
interval
;
return
TSDB_CODE_SUCCESS
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录