Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4ad9e11b
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看板
提交
4ad9e11b
编写于
2月 26, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-2895] refactor.
上级
921eaa1c
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
18 addition
and
13 deletion
+18
-13
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+18
-13
未找到文件。
src/query/src/qExecutor.c
浏览文件 @
4ad9e11b
...
...
@@ -573,20 +573,20 @@ static SResultRow *doPrepareResultRowFromKey(SQueryRuntimeEnv *pRuntimeEnv, SRes
}
// get the correct time window according to the handled timestamp
static
STimeWindow
getActiveTimeWindow
(
SResultRowInfo
*
pWindowRes
Info
,
int64_t
ts
,
SQuery
*
pQuery
)
{
static
STimeWindow
getActiveTimeWindow
(
SResultRowInfo
*
pResultRow
Info
,
int64_t
ts
,
SQuery
*
pQuery
)
{
STimeWindow
w
=
{
0
};
if
(
p
WindowRes
Info
->
curIndex
==
-
1
)
{
// the first window, from the previous stored value
if
(
p
WindowRes
Info
->
prevSKey
==
TSKEY_INITIAL_VAL
)
{
if
(
p
ResultRow
Info
->
curIndex
==
-
1
)
{
// the first window, from the previous stored value
if
(
p
ResultRow
Info
->
prevSKey
==
TSKEY_INITIAL_VAL
)
{
if
(
QUERY_IS_ASC_QUERY
(
pQuery
))
{
getAlignQueryTimeWindow
(
pQuery
,
ts
,
ts
,
pQuery
->
window
.
ekey
,
&
w
);
}
else
{
// the start position of the first time window in the endpoint that spreads beyond the queried last timestamp
getAlignQueryTimeWindow
(
pQuery
,
ts
,
pQuery
->
window
.
ekey
,
ts
,
&
w
);
}
p
WindowRes
Info
->
prevSKey
=
w
.
skey
;
p
ResultRow
Info
->
prevSKey
=
w
.
skey
;
}
else
{
w
.
skey
=
p
WindowRes
Info
->
prevSKey
;
w
.
skey
=
p
ResultRow
Info
->
prevSKey
;
}
if
(
pQuery
->
interval
.
intervalUnit
==
'n'
||
pQuery
->
interval
.
intervalUnit
==
'y'
)
{
...
...
@@ -595,8 +595,8 @@ static STimeWindow getActiveTimeWindow(SResultRowInfo *pWindowResInfo, int64_t t
w
.
ekey
=
w
.
skey
+
pQuery
->
interval
.
interval
-
1
;
}
}
else
{
int32_t
slot
=
curTimeWindowIndex
(
p
WindowRes
Info
);
SResultRow
*
pWindowRes
=
getResultRow
(
p
WindowRes
Info
,
slot
);
int32_t
slot
=
curTimeWindowIndex
(
p
ResultRow
Info
);
SResultRow
*
pWindowRes
=
getResultRow
(
p
ResultRow
Info
,
slot
);
w
=
pWindowRes
->
win
;
}
...
...
@@ -4376,12 +4376,6 @@ void setIntervalQueryRange(SQueryRuntimeEnv *pRuntimeEnv, TSKEY key) {
pTableQueryInfo
->
win
.
skey
=
key
;
STimeWindow
win
=
{.
skey
=
key
,
.
ekey
=
pQuery
->
window
.
ekey
};
// for too small query range, no data in this interval.
if
((
QUERY_IS_ASC_QUERY
(
pQuery
)
&&
(
pQuery
->
window
.
ekey
<
pQuery
->
window
.
skey
))
||
(
!
QUERY_IS_ASC_QUERY
(
pQuery
)
&&
(
pQuery
->
window
.
skey
<
pQuery
->
window
.
ekey
)))
{
return
;
}
/**
* In handling the both ascending and descending order super table query, we need to find the first qualified
* timestamp of this table, and then set the first qualified start timestamp.
...
...
@@ -4398,6 +4392,7 @@ void setIntervalQueryRange(SQueryRuntimeEnv *pRuntimeEnv, TSKEY key) {
if
(
!
QUERY_IS_ASC_QUERY
(
pQuery
))
{
assert
(
win
.
ekey
==
pQuery
->
window
.
ekey
);
}
pWindowResInfo
->
prevSKey
=
w
.
skey
;
}
...
...
@@ -6106,6 +6101,8 @@ static SSDataBlock* doTableScan(void* param) {
SQueryRuntimeEnv
*
pRuntimeEnv
=
pTableScanInfo
->
pRuntimeEnv
;
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
SResultRowInfo
*
pResultRowInfo
=
pTableScanInfo
->
pResultRowInfo
;
while
(
pTableScanInfo
->
current
<
pTableScanInfo
->
times
)
{
SSDataBlock
*
p
=
doTableScanImpl
(
pTableScanInfo
);
if
(
p
!=
NULL
)
{
...
...
@@ -6132,6 +6129,9 @@ static SSDataBlock* doTableScan(void* param) {
assert
(
ret
);
}
pResultRowInfo
->
curIndex
=
0
;
pResultRowInfo
->
prevSKey
=
pResultRowInfo
->
pResult
[
0
]
->
win
.
skey
;
qDebug
(
"QInfo:%p start to repeat scan data blocks due to query func required, qrange:%"
PRId64
"-%"
PRId64
,
pRuntimeEnv
->
qinfo
,
cond
.
twindow
.
skey
,
cond
.
twindow
.
ekey
);
}
...
...
@@ -6152,6 +6152,11 @@ static SSDataBlock* doTableScan(void* param) {
pTableScanInfo
->
reverseTimes
=
0
;
pTableScanInfo
->
order
=
cond
.
order
;
// todo refactor, extract function
SResultRowInfo
*
pResultRowInfo
=
pTableScanInfo
->
pResultRowInfo
;
pResultRowInfo
->
curIndex
=
pResultRowInfo
->
size
-
1
;
pResultRowInfo
->
prevSKey
=
pResultRowInfo
->
pResult
[
pResultRowInfo
->
size
-
1
]
->
win
.
skey
;
SSDataBlock
*
p
=
doTableScanImpl
(
pTableScanInfo
);
if
(
p
!=
NULL
)
{
return
p
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录