Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ff72e66d
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ff72e66d
编写于
6月 27, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): support scalar function before applying interval aggregate.
上级
916adb82
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
33 addition
and
12 deletion
+33
-12
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+2
-2
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+2
-2
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+3
-3
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+26
-5
未找到文件。
source/libs/executor/inc/executorimpl.h
浏览文件 @
ff72e66d
...
...
@@ -400,7 +400,7 @@ typedef struct SIntervalAggOperatorInfo {
// SOptrBasicInfo should be first, SAggSupporter should be second for stream encode
SOptrBasicInfo
binfo
;
// basic info
SAggSupporter
aggSup
;
// aggregate supporter
SExprSupp
scalarSupp
;
// supporter for perform scalar function
SGroupResInfo
groupResInfo
;
// multiple results build supporter
SInterval
interval
;
// interval info
int32_t
primaryTsIndex
;
// primary time stamp slot id from result of downstream operator.
...
...
@@ -730,7 +730,7 @@ SOperatorInfo* createSortedMergeOperatorInfo(SOperatorInfo** downstream, int32_t
SOperatorInfo
*
createIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SSDataBlock
*
pResBlock
,
SInterval
*
pInterval
,
int32_t
primaryTsSlotId
,
STimeWindowAggSupp
*
pTwAggSupp
,
SExecTaskInfo
*
pTaskInfo
,
bool
isStream
);
STimeWindowAggSupp
*
pTwAggSupp
,
SIntervalPhysiNode
*
pPhyNode
,
SExecTaskInfo
*
pTaskInfo
,
bool
isStream
);
SOperatorInfo
*
createMergeIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SSDataBlock
*
pResBlock
,
SInterval
*
pInterval
,
int32_t
primaryTsSlotId
,
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
ff72e66d
...
...
@@ -4216,8 +4216,8 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
int32_t
tsSlotId
=
((
SColumnNode
*
)
pIntervalPhyNode
->
window
.
pTspk
)
->
slotId
;
bool
isStream
=
(
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
==
type
);
pOptr
=
createIntervalOperatorInfo
(
ops
[
0
],
pExprInfo
,
num
,
pResBlock
,
&
interval
,
tsSlotId
,
&
as
,
pTaskInfo
,
isStream
);
pOptr
=
createIntervalOperatorInfo
(
ops
[
0
],
pExprInfo
,
num
,
pResBlock
,
&
interval
,
tsSlotId
,
&
as
,
pIntervalPhyNode
,
pTaskInfo
,
isStream
);
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL
==
type
)
{
SMergeAlignedIntervalPhysiNode
*
pIntervalPhyNode
=
(
SMergeAlignedIntervalPhysiNode
*
)
pPhyNode
;
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
ff72e66d
...
...
@@ -448,7 +448,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) {
qDebug
(
"%s start to repeat ascending order scan data blocks due to query func required"
,
GET_TASKID
(
pTaskInfo
));
for
(
int32_t
i
=
0
;
i
<
pTableScanInfo
->
cond
.
numOfTWindows
;
++
i
)
{
STimeWindow
*
pWin
=
&
pTableScanInfo
->
cond
.
twindows
[
i
];
qDebug
(
"%s
\t
qrange:%"
PRId64
"-%"
PRId64
,
GET_TASKID
(
pTaskInfo
),
pWin
->
skey
,
pWin
->
ekey
);
qDebug
(
"%s qrange:%"
PRId64
"-%"
PRId64
,
GET_TASKID
(
pTaskInfo
),
pWin
->
skey
,
pWin
->
ekey
);
}
// do prepare for the next round table scan operation
tsdbResetReadHandle
(
pTableScanInfo
->
dataReader
,
&
pTableScanInfo
->
cond
,
0
);
...
...
@@ -467,7 +467,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) {
qDebug
(
"%s start to descending order scan data blocks due to query func required"
,
GET_TASKID
(
pTaskInfo
));
for
(
int32_t
i
=
0
;
i
<
pTableScanInfo
->
cond
.
numOfTWindows
;
++
i
)
{
STimeWindow
*
pWin
=
&
pTableScanInfo
->
cond
.
twindows
[
i
];
qDebug
(
"%s
\t
qrange:%"
PRId64
"-%"
PRId64
,
GET_TASKID
(
pTaskInfo
),
pWin
->
skey
,
pWin
->
ekey
);
qDebug
(
"%s qrange:%"
PRId64
"-%"
PRId64
,
GET_TASKID
(
pTaskInfo
),
pWin
->
skey
,
pWin
->
ekey
);
}
while
(
pTableScanInfo
->
scanTimes
<
total
)
{
...
...
@@ -492,7 +492,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) {
GET_TASKID
(
pTaskInfo
));
for
(
int32_t
i
=
0
;
i
<
pTableScanInfo
->
cond
.
numOfTWindows
;
++
i
)
{
STimeWindow
*
pWin
=
&
pTableScanInfo
->
cond
.
twindows
[
i
];
qDebug
(
"%s
\t
qrange:%"
PRId64
"-%"
PRId64
,
GET_TASKID
(
pTaskInfo
),
pWin
->
skey
,
pWin
->
ekey
);
qDebug
(
"%s qrange:%"
PRId64
"-%"
PRId64
,
GET_TASKID
(
pTaskInfo
),
pWin
->
skey
,
pWin
->
ekey
);
}
tsdbResetReadHandle
(
pTableScanInfo
->
dataReader
,
&
pTableScanInfo
->
cond
,
0
);
pTableScanInfo
->
curTWinIdx
=
0
;
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
ff72e66d
...
...
@@ -956,6 +956,12 @@ static int32_t doOpenIntervalAgg(SOperatorInfo* pOperator) {
getTableScanInfo
(
pOperator
,
&
pInfo
->
order
,
&
scanFlag
);
if
(
pInfo
->
scalarSupp
.
pExprInfo
!=
NULL
)
{
SExprSupp
*
pExprSup
=&
pInfo
->
scalarSupp
;
projectApplyFunctions
(
pExprSup
->
pExprInfo
,
pBlock
,
pBlock
,
pExprSup
->
pCtx
,
pExprSup
->
numOfExprs
,
NULL
);
}
// the pDataBlock are always the same one, no need to call this again
setInputDataBlock
(
pOperator
,
pSup
->
pCtx
,
pBlock
,
pInfo
->
order
,
scanFlag
,
true
);
hashIntervalAgg
(
pOperator
,
&
pInfo
->
binfo
.
resultRowInfo
,
pBlock
,
scanFlag
,
NULL
);
...
...
@@ -1324,6 +1330,12 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
break
;
}
if
(
pInfo
->
scalarSupp
.
pExprInfo
!=
NULL
)
{
SExprSupp
*
pExprSup
=
&
pInfo
->
scalarSupp
;
projectApplyFunctions
(
pExprSup
->
pExprInfo
,
pBlock
,
pBlock
,
pExprSup
->
pCtx
,
pExprSup
->
numOfExprs
,
NULL
);
}
if
(
pBlock
->
info
.
type
==
STREAM_REPROCESS
)
{
doClearWindows
(
&
pInfo
->
aggSup
,
&
pOperator
->
exprSupp
,
&
pInfo
->
interval
,
0
,
pOperator
->
exprSupp
.
numOfExprs
,
pBlock
,
NULL
);
...
...
@@ -1446,18 +1458,27 @@ void increaseTs(SqlFunctionCtx* pCtx) {
SOperatorInfo
*
createIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SSDataBlock
*
pResBlock
,
SInterval
*
pInterval
,
int32_t
primaryTsSlotId
,
STimeWindowAggSupp
*
pTwAggSupp
,
SExecTaskInfo
*
pTaskInfo
,
bool
isStream
)
{
STimeWindowAggSupp
*
pTwAggSupp
,
S
IntervalPhysiNode
*
pPhyNode
,
S
ExecTaskInfo
*
pTaskInfo
,
bool
isStream
)
{
SIntervalAggOperatorInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SIntervalAggOperatorInfo
));
SOperatorInfo
*
pOperator
=
taosMemoryCalloc
(
1
,
sizeof
(
SOperatorInfo
));
if
(
pInfo
==
NULL
||
pOperator
==
NULL
)
{
goto
_error
;
}
pInfo
->
win
=
pTaskInfo
->
window
;
pInfo
->
order
=
TSDB_ORDER_ASC
;
pInfo
->
interval
=
*
pInterval
;
pInfo
->
win
=
pTaskInfo
->
window
;
pInfo
->
order
=
TSDB_ORDER_ASC
;
pInfo
->
interval
=
*
pInterval
;
pInfo
->
execModel
=
pTaskInfo
->
execModel
;
pInfo
->
twAggSup
=
*
pTwAggSupp
;
pInfo
->
twAggSup
=
*
pTwAggSupp
;
if
(
pPhyNode
->
window
.
pExprs
!=
NULL
)
{
int32_t
numOfScalar
=
0
;
SExprInfo
*
pScalarExprInfo
=
createExprInfo
(
pPhyNode
->
window
.
pExprs
,
NULL
,
&
numOfScalar
);
int32_t
code
=
initExprSupp
(
&
pInfo
->
scalarSupp
,
pScalarExprInfo
,
numOfScalar
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
}
pInfo
->
primaryTsIndex
=
primaryTsSlotId
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录