Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
81036205
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,发现更多精彩内容 >>
提交
81036205
编写于
12月 02, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-225] refactor codes.
上级
0c38e1d9
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
16 addition
and
34 deletion
+16
-34
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+7
-8
src/query/inc/qUtil.h
src/query/inc/qUtil.h
+1
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+6
-22
src/query/src/qUtil.c
src/query/src/qUtil.c
+2
-3
未找到文件。
src/query/inc/qExecutor.h
浏览文件 @
81036205
...
...
@@ -87,7 +87,6 @@ typedef struct SWindowResInfo {
SResultRow
**
pResult
;
// result list
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
int64_t
startTime
;
// start time of the first time window for sliding query
...
...
src/query/inc/qUtil.h
浏览文件 @
81036205
...
...
@@ -30,7 +30,7 @@ void clearResultRow(SQueryRuntimeEnv* pRuntimeEnv, SResultRow* pRow, int16_t typ
void
copyResultRow
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SResultRow
*
dst
,
const
SResultRow
*
src
,
int16_t
type
);
SResultRowCellInfo
*
getResultCell
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
const
SResultRow
*
pRow
,
int32_t
index
);
int32_t
initWindowResInfo
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
size
,
int
32_t
threshold
,
int
16_t
type
);
int32_t
initWindowResInfo
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
size
,
int16_t
type
);
void
cleanupTimeWindowInfo
(
SWindowResInfo
*
pWindowResInfo
);
void
resetTimeWindowInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SWindowResInfo
*
pWindowResInfo
);
...
...
src/query/src/qExecutor.c
浏览文件 @
81036205
...
...
@@ -761,7 +761,7 @@ static int32_t doCheckQueryCompleted(SQueryRuntimeEnv *pRuntimeEnv, TSKEY lastKe
pWindowResInfo
->
prevSKey
=
pWindowResInfo
->
pResult
[
pWindowResInfo
->
curIndex
]
->
win
.
skey
;
// the number of completed slots are larger than the threshold, return current generated results to client.
if
(
numOfClosed
>
p
WindowResInfo
->
threshold
)
{
if
(
numOfClosed
>
p
Query
->
rec
.
threshold
)
{
qDebug
(
"QInfo:%p total result window:%d closed:%d, reached the output threshold %d, return"
,
GET_QINFO_ADDR
(
pRuntimeEnv
),
pWindowResInfo
->
size
,
numOfClosed
,
pQuery
->
rec
.
threshold
);
...
...
@@ -3587,17 +3587,9 @@ static void updateTableQueryInfoForReverseScan(SQuery *pQuery, STableQueryInfo *
// order has changed already
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pQuery
->
order
.
order
);
// TODO validate the assertion
// if (!QUERY_IS_ASC_QUERY(pQuery)) {
// assert(pTableQueryInfo->win.ekey >= pTableQueryInfo->lastKey + step);
// } else {
// assert(pTableQueryInfo->win.ekey <= pTableQueryInfo->lastKey + step);
// }
if
(
pTableQueryInfo
->
lastKey
==
pTableQueryInfo
->
win
.
skey
)
{
// do nothing, no results
}
else
{
// even win.skey != lastKey, the results may not generated.
}
else
{
//
NOTE:
even win.skey != lastKey, the results may not generated.
pTableQueryInfo
->
win
.
ekey
=
pTableQueryInfo
->
lastKey
+
step
;
}
...
...
@@ -4102,9 +4094,8 @@ static STableQueryInfo *createTableQueryInfo(SQueryRuntimeEnv *pRuntimeEnv, void
// set more initial size of interval/groupby query
if
(
QUERY_IS_INTERVAL_QUERY
(
pQuery
)
||
pRuntimeEnv
->
groupbyNormalCol
)
{
int32_t
initialSize
=
16
;
int32_t
initialThreshold
=
100
;
int32_t
code
=
initWindowResInfo
(
&
pTableQueryInfo
->
windowResInfo
,
initialSize
,
initialThreshold
,
TSDB_DATA_TYPE_INT
);
int32_t
initialSize
=
128
;
int32_t
code
=
initWindowResInfo
(
&
pTableQueryInfo
->
windowResInfo
,
initialSize
,
TSDB_DATA_TYPE_INT
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
NULL
;
}
...
...
@@ -4989,20 +4980,13 @@ int32_t doInitQInfo(SQInfo *pQInfo, STSBuf *pTsBuf, void *tsdb, int32_t vgId, bo
if
(
!
QUERY_IS_INTERVAL_QUERY
(
pQuery
))
{
int16_t
type
=
TSDB_DATA_TYPE_NULL
;
int32_t
threshold
=
0
;
if
(
pRuntimeEnv
->
groupbyNormalCol
)
{
// group by columns not tags;
type
=
getGroupbyColumnType
(
pQuery
,
pQuery
->
pGroupbyExpr
);
threshold
=
4000
;
}
else
{
type
=
TSDB_DATA_TYPE_INT
;
// group id
threshold
=
(
int32_t
)(
GET_NUM_OF_TABLEGROUP
(
pQInfo
));
if
(
threshold
<
8
)
{
threshold
=
8
;
}
}
code
=
initWindowResInfo
(
&
pRuntimeEnv
->
windowResInfo
,
8
,
t
hreshold
,
t
ype
);
code
=
initWindowResInfo
(
&
pRuntimeEnv
->
windowResInfo
,
8
,
type
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -5022,7 +5006,7 @@ int32_t doInitQInfo(SQInfo *pQInfo, STSBuf *pTsBuf, void *tsdb, int32_t vgId, bo
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
}
code
=
initWindowResInfo
(
&
pRuntimeEnv
->
windowResInfo
,
numOfResultRows
,
1024
,
type
);
code
=
initWindowResInfo
(
&
pRuntimeEnv
->
windowResInfo
,
numOfResultRows
,
type
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
src/query/src/qUtil.c
浏览文件 @
81036205
...
...
@@ -43,9 +43,8 @@ int32_t getOutputInterResultBufSize(SQuery* pQuery) {
return
size
;
}
int32_t
initWindowResInfo
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
size
,
int
32_t
threshold
,
int
16_t
type
)
{
int32_t
initWindowResInfo
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
size
,
int16_t
type
)
{
pWindowResInfo
->
capacity
=
size
;
pWindowResInfo
->
threshold
=
threshold
;
pWindowResInfo
->
type
=
type
;
pWindowResInfo
->
curIndex
=
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录