Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
40361797
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看板
提交
40361797
编写于
6月 01, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): fix error in fill.
上级
1036259a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
21 deletion
+19
-21
source/libs/executor/src/filloperator.c
source/libs/executor/src/filloperator.c
+19
-21
未找到文件。
source/libs/executor/src/filloperator.c
浏览文件 @
40361797
...
...
@@ -61,24 +61,24 @@ typedef struct SFillOperatorInfo {
SExprSupp
noFillExprSupp
;
}
SFillOperatorInfo
;
static
void
revisedFillStartKey
(
SFillOperatorInfo
*
pInfo
,
SSDataBlock
*
pBlock
);
static
void
revisedFillStartKey
(
SFillOperatorInfo
*
pInfo
,
SSDataBlock
*
pBlock
,
int32_t
order
);
static
void
destroyFillOperatorInfo
(
void
*
param
);
static
void
doApplyScalarCalculation
(
SOperatorInfo
*
pOperator
,
SSDataBlock
*
pBlock
,
int32_t
order
,
int32_t
scanFlag
);
static
void
doHandleRemainBlockForNewGroupImpl
(
SOperatorInfo
*
pOperator
,
SFillOperatorInfo
*
pInfo
,
SResultInfo
*
pResultInfo
,
SExecTaskInfo
*
pTaskInfo
)
{
SResultInfo
*
pResultInfo
,
int32_t
order
)
{
pInfo
->
totalInputRows
=
pInfo
->
existNewGroupBlock
->
info
.
rows
;
SSDataBlock
*
pResBlock
=
pInfo
->
pFinalRes
;
int32_t
order
=
TSDB_ORDER_ASC
;
//
int32_t order = TSDB_ORDER_ASC;
int32_t
scanFlag
=
MAIN_SCAN
;
getTableScanInfo
(
pOperator
,
&
order
,
&
scanFlag
,
false
);
//
getTableScanInfo(pOperator, &order, &scanFlag, false);
taosResetFillInfo
(
pInfo
->
pFillInfo
,
getFillInfoStart
(
pInfo
->
pFillInfo
));
blockDataCleanup
(
pInfo
->
pRes
);
doApplyScalarCalculation
(
pOperator
,
pInfo
->
existNewGroupBlock
,
order
,
scanFlag
);
revisedFillStartKey
(
pInfo
,
pInfo
->
existNewGroupBlock
);
revisedFillStartKey
(
pInfo
,
pInfo
->
existNewGroupBlock
,
order
);
int64_t
ts
=
(
order
==
TSDB_ORDER_ASC
)
?
pInfo
->
existNewGroupBlock
->
info
.
window
.
ekey
:
pInfo
->
existNewGroupBlock
->
info
.
window
.
skey
;
taosFillSetStartInfo
(
pInfo
->
pFillInfo
,
pInfo
->
pRes
->
info
.
rows
,
ts
);
...
...
@@ -93,7 +93,7 @@ static void doHandleRemainBlockForNewGroupImpl(SOperatorInfo* pOperator, SFillOp
}
static
void
doHandleRemainBlockFromNewGroup
(
SOperatorInfo
*
pOperator
,
SFillOperatorInfo
*
pInfo
,
SResultInfo
*
pResultInfo
,
SExecTaskInfo
*
pTaskInfo
)
{
SResultInfo
*
pResultInfo
,
int32_t
order
)
{
if
(
taosFillHasMoreResults
(
pInfo
->
pFillInfo
))
{
int32_t
numOfResultRows
=
pResultInfo
->
capacity
-
pInfo
->
pFinalRes
->
info
.
rows
;
taosFillResultDataBlock
(
pInfo
->
pFillInfo
,
pInfo
->
pFinalRes
,
numOfResultRows
);
...
...
@@ -103,7 +103,7 @@ static void doHandleRemainBlockFromNewGroup(SOperatorInfo* pOperator, SFillOpera
// handle the cached new group data block
if
(
pInfo
->
existNewGroupBlock
)
{
doHandleRemainBlockForNewGroupImpl
(
pOperator
,
pInfo
,
pResultInfo
,
pTaskInfo
);
doHandleRemainBlockForNewGroupImpl
(
pOperator
,
pInfo
,
pResultInfo
,
order
);
}
}
...
...
@@ -123,9 +123,7 @@ void doApplyScalarCalculation(SOperatorInfo* pOperator, SSDataBlock* pBlock, int
}
// todo refactor: decide the start key according to the query time range.
static
void
revisedFillStartKey
(
SFillOperatorInfo
*
pInfo
,
SSDataBlock
*
pBlock
)
{
int32_t
order
=
pInfo
->
pFillInfo
->
order
;
static
void
revisedFillStartKey
(
SFillOperatorInfo
*
pInfo
,
SSDataBlock
*
pBlock
,
int32_t
order
)
{
if
(
order
==
TSDB_ORDER_ASC
)
{
int64_t
skey
=
pBlock
->
info
.
window
.
skey
;
if
(
skey
<
pInfo
->
pFillInfo
->
start
)
{
// the start key may be smaller than the
...
...
@@ -137,7 +135,7 @@ static void revisedFillStartKey(SFillOperatorInfo* pInfo, SSDataBlock* pBlock) {
while
(
1
)
{
int64_t
prev
=
taosTimeAdd
(
t
,
-
pInterval
->
sliding
,
pInterval
->
slidingUnit
,
pInterval
->
precision
);
if
(
prev
<
pInfo
->
pFillInfo
->
start
)
{
if
(
prev
<
=
pInfo
->
pFillInfo
->
start
)
{
t
=
prev
;
break
;
}
...
...
@@ -158,7 +156,7 @@ static void revisedFillStartKey(SFillOperatorInfo* pInfo, SSDataBlock* pBlock) {
while
(
1
)
{
int64_t
prev
=
taosTimeAdd
(
t
,
pInterval
->
sliding
,
pInterval
->
slidingUnit
,
pInterval
->
precision
);
if
(
prev
<
pInfo
->
pFillInfo
->
start
)
{
if
(
prev
>=
pInfo
->
pFillInfo
->
start
)
{
t
=
prev
;
break
;
}
...
...
@@ -184,12 +182,6 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
int32_t
scanFlag
=
MAIN_SCAN
;
getTableScanInfo
(
pOperator
,
&
order
,
&
scanFlag
,
false
);
doHandleRemainBlockFromNewGroup
(
pOperator
,
pInfo
,
pResultInfo
,
pTaskInfo
);
if
(
pResBlock
->
info
.
rows
>
0
)
{
pResBlock
->
info
.
id
.
groupId
=
pInfo
->
curGroupId
;
return
pResBlock
;
}
SOperatorInfo
*
pDownstream
=
pOperator
->
pDownstream
[
0
];
// the scan order may be different from the output result order for agg interval operator.
...
...
@@ -197,6 +189,12 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
order
=
((
SIntervalAggOperatorInfo
*
)
pDownstream
->
info
)
->
resultTsOrder
;
}
doHandleRemainBlockFromNewGroup
(
pOperator
,
pInfo
,
pResultInfo
,
order
);
if
(
pResBlock
->
info
.
rows
>
0
)
{
pResBlock
->
info
.
id
.
groupId
=
pInfo
->
curGroupId
;
return
pResBlock
;
}
while
(
1
)
{
SSDataBlock
*
pBlock
=
pDownstream
->
fpSet
.
getNextFn
(
pDownstream
);
if
(
pBlock
==
NULL
)
{
...
...
@@ -218,7 +216,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
if
(
pInfo
->
curGroupId
==
0
||
(
pInfo
->
curGroupId
==
pInfo
->
pRes
->
info
.
id
.
groupId
))
{
if
(
pInfo
->
curGroupId
==
0
)
{
revisedFillStartKey
(
pInfo
,
pBlock
);
revisedFillStartKey
(
pInfo
,
pBlock
,
order
);
}
pInfo
->
curGroupId
=
pInfo
->
pRes
->
info
.
id
.
groupId
;
// the first data block
...
...
@@ -249,7 +247,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
return
pResBlock
;
}
doHandleRemainBlockFromNewGroup
(
pOperator
,
pInfo
,
pResultInfo
,
pTaskInfo
);
doHandleRemainBlockFromNewGroup
(
pOperator
,
pInfo
,
pResultInfo
,
order
);
if
(
pResBlock
->
info
.
rows
>=
pOperator
->
resultInfo
.
threshold
||
pBlock
==
NULL
)
{
pResBlock
->
info
.
id
.
groupId
=
pInfo
->
curGroupId
;
return
pResBlock
;
...
...
@@ -257,7 +255,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
}
else
if
(
pInfo
->
existNewGroupBlock
)
{
// try next group
blockDataCleanup
(
pResBlock
);
doHandleRemainBlockForNewGroupImpl
(
pOperator
,
pInfo
,
pResultInfo
,
pTaskInfo
);
doHandleRemainBlockForNewGroupImpl
(
pOperator
,
pInfo
,
pResultInfo
,
order
);
if
(
pResBlock
->
info
.
rows
>
pResultInfo
->
threshold
)
{
pResBlock
->
info
.
id
.
groupId
=
pInfo
->
curGroupId
;
return
pResBlock
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录