Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a74c8301
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看板
提交
a74c8301
编写于
8月 06, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): support scalar function in fill operator.
上级
d1c6835e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
32 addition
and
18 deletion
+32
-18
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+4
-1
source/libs/executor/inc/tfill.h
source/libs/executor/inc/tfill.h
+1
-0
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+11
-8
source/libs/executor/src/tfill.c
source/libs/executor/src/tfill.c
+15
-9
tests/script/tsim/parser/fill_us.sim
tests/script/tsim/parser/fill_us.sim
+1
-0
未找到文件。
source/libs/executor/inc/executorimpl.h
浏览文件 @
a74c8301
...
...
@@ -627,12 +627,15 @@ typedef struct SFillOperatorInfo {
int64_t
totalInputRows
;
void
**
p
;
SSDataBlock
*
existNewGroupBlock
;
bool
multigroupResult
;
STimeWindow
win
;
SNode
*
pCondition
;
SArray
*
pColMatchColInfo
;
int32_t
primaryTsCol
;
uint64_t
curGroupId
;
// current handled group id
SExprInfo
*
pExprInfo
;
int32_t
numOfExpr
;
SExprInfo
*
pNotFillExprInfo
;
int32_t
numOfNotFillExpr
;
}
SFillOperatorInfo
;
typedef
struct
SGroupbyOperatorInfo
{
...
...
source/libs/executor/inc/tfill.h
浏览文件 @
a74c8301
...
...
@@ -44,6 +44,7 @@ typedef struct SFillInfo {
TSKEY
end
;
// endKey for fill
TSKEY
currentKey
;
// current active timestamp, the value may be changed during the fill procedure.
int32_t
tsSlotId
;
// primary time stamp slot id
int32_t
srcTsSlotId
;
// timestamp column id in the source data block.
int32_t
order
;
// order [TSDB_ORDER_ASC|TSDB_ORDER_DESC]
int32_t
type
;
// fill type
int32_t
numOfRows
;
// number of rows in the input data block
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
a74c8301
...
...
@@ -3244,7 +3244,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
SSDataBlock
*
pBlock
=
pDownstream
->
fpSet
.
getNextFn
(
pDownstream
);
if
(
pBlock
==
NULL
)
{
if
(
pInfo
->
totalInputRows
==
0
)
{
pOperator
->
status
=
OP_EXEC_DONE
;
doSetOperatorCompleted
(
pOperator
)
;
return
NULL
;
}
...
...
@@ -3252,6 +3252,9 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
}
else
{
blockDataUpdateTsWindow
(
pBlock
,
pInfo
->
primaryTsCol
);
SExprSupp
*
pSup
=
&
pOperator
->
exprSupp
;
projectApplyFunctions
(
pSup
->
pExprInfo
,
pInfo
->
pRes
,
pBlock
,
pSup
->
pCtx
,
pSup
->
numOfExprs
,
NULL
);
if
(
pInfo
->
curGroupId
==
0
||
pInfo
->
curGroupId
==
pBlock
->
info
.
groupId
)
{
pInfo
->
curGroupId
=
pBlock
->
info
.
groupId
;
// the first data block
...
...
@@ -3629,10 +3632,9 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
goto
_error
;
}
int32_t
num
=
0
,
num1
=
0
;
SSDataBlock
*
pResBlock
=
createResDataBlock
(
pPhyFillNode
->
node
.
pOutputDataBlockDesc
);
SExprInfo
*
pExprInfo
=
createExprInfo
(
pPhyFillNode
->
pFillExprs
,
NULL
,
&
num
);
SExprInfo
*
pCopyColumnExprInfo
=
createExprInfo
(
pPhyFillNode
->
pNotFillExprs
,
NULL
,
&
num1
);
SExprInfo
*
pExprInfo
=
createExprInfo
(
pPhyFillNode
->
pFillExprs
,
NULL
,
&
pInfo
->
numOfExpr
);
SExprInfo
*
pCopyColumnExprInfo
=
createExprInfo
(
pPhyFillNode
->
pNotFillExprs
,
NULL
,
&
pInfo
->
numOfNotFillExpr
);
SInterval
*
pInterval
=
QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL
==
downstream
->
operatorType
...
...
@@ -3645,6 +3647,7 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
SResultInfo
*
pResultInfo
=
&
pOperator
->
resultInfo
;
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
4096
);
blockDataEnsureCapacity
(
pResBlock
,
pOperator
->
resultInfo
.
capacity
);
initExprSupp
(
&
pOperator
->
exprSupp
,
pExprInfo
,
pInfo
->
numOfExpr
);
pInfo
->
primaryTsCol
=
((
SColumnNode
*
)
pPhyFillNode
->
pWStartTs
)
->
slotId
;
...
...
@@ -3652,9 +3655,9 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
SArray
*
pColMatchColInfo
=
extractColMatchInfo
(
pPhyFillNode
->
pFillExprs
,
pPhyFillNode
->
node
.
pOutputDataBlockDesc
,
&
numOfOutputCols
,
COL_MATCH_FROM_SLOT_ID
);
int32_t
code
=
initFillInfo
(
pInfo
,
pExprInfo
,
num
,
pCopyColumnExprInfo
,
num1
,
(
SNodeListNode
*
)
pPhyFillNode
->
pValues
,
pPhyFillNode
->
timeRange
,
pResultInfo
->
capacity
,
pTaskInfo
->
id
.
str
,
pInterval
,
type
,
order
);
int32_t
code
=
initFillInfo
(
pInfo
,
pExprInfo
,
pInfo
->
numOfExpr
,
pCopyColumnExprInfo
,
pInfo
->
numOfNotFillExpr
,
(
SNodeListNode
*
)
pPhyFillNode
->
pValues
,
pPhyFillNode
->
timeRange
,
pResultInfo
->
capacity
,
pTaskInfo
->
id
.
str
,
pInterval
,
type
,
order
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -3667,7 +3670,7 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_FILL
;
pOperator
->
exprSupp
.
pExprInfo
=
pExprInfo
;
pOperator
->
exprSupp
.
numOfExprs
=
num
;
pOperator
->
exprSupp
.
numOfExprs
=
pInfo
->
numOfExpr
;
pOperator
->
info
=
pInfo
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
...
...
source/libs/executor/src/tfill.c
浏览文件 @
a74c8301
...
...
@@ -258,7 +258,7 @@ static void copyCurrentRowIntoBuf(SFillInfo* pFillInfo, int32_t rowIndex, SArray
static
int32_t
fillResultImpl
(
SFillInfo
*
pFillInfo
,
SSDataBlock
*
pBlock
,
int32_t
outputRows
)
{
pFillInfo
->
numOfCurrent
=
0
;
SColumnInfoData
*
pTsCol
=
taosArrayGet
(
pFillInfo
->
pSrcBlock
->
pDataBlock
,
pFillInfo
->
t
sSlotId
);
SColumnInfoData
*
pTsCol
=
taosArrayGet
(
pFillInfo
->
pSrcBlock
->
pDataBlock
,
pFillInfo
->
srcT
sSlotId
);
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pFillInfo
->
order
);
bool
ascFill
=
FILL_IS_ASC_FILL
(
pFillInfo
);
...
...
@@ -349,10 +349,6 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t
}
if
(
pFillInfo
->
index
>=
pFillInfo
->
numOfRows
||
pFillInfo
->
numOfCurrent
>=
outputRows
)
{
/* the raw data block is exhausted, next value does not exists */
// if (pFillInfo->index >= pFillInfo->numOfRows) {
// taosMemoryFreeClear(*next);
// }
pFillInfo
->
numOfTotal
+=
pFillInfo
->
numOfCurrent
;
return
pFillInfo
->
numOfCurrent
;
}
...
...
@@ -413,7 +409,17 @@ struct SFillInfo* taosCreateFillInfo(TSKEY skey, int32_t numOfFillCols, int32_t
}
pFillInfo
->
order
=
order
;
pFillInfo
->
tsSlotId
=
primaryTsSlotId
;
pFillInfo
->
srcTsSlotId
=
primaryTsSlotId
;
for
(
int32_t
i
=
0
;
i
<
numOfNotFillCols
;
++
i
)
{
SFillColInfo
*
p
=
&
pCol
[
i
+
numOfFillCols
];
int32_t
srcSlotId
=
GET_SRC_SLOT_ID
(
p
);
if
(
srcSlotId
==
primaryTsSlotId
)
{
pFillInfo
->
tsSlotId
=
i
+
numOfFillCols
;
break
;
}
}
taosResetFillInfo
(
pFillInfo
,
skey
);
switch
(
fillType
)
{
...
...
@@ -531,7 +537,7 @@ bool taosFillHasMoreResults(SFillInfo* pFillInfo) {
}
int64_t
getNumOfResultsAfterFillGap
(
SFillInfo
*
pFillInfo
,
TSKEY
ekey
,
int32_t
maxNumOfRows
)
{
SColumnInfoData
*
pCol
=
taosArrayGet
(
pFillInfo
->
pSrcBlock
->
pDataBlock
,
0
);
SColumnInfoData
*
pCol
=
taosArrayGet
(
pFillInfo
->
pSrcBlock
->
pDataBlock
,
pFillInfo
->
srcTsSlotId
);
int64_t
*
tsList
=
(
int64_t
*
)
pCol
->
pData
;
int32_t
numOfRows
=
taosNumOfRemainRows
(
pFillInfo
);
...
...
@@ -619,9 +625,9 @@ SFillColInfo* createFillColInfo(SExprInfo* pExpr, int32_t numOfFillExpr, SExprIn
nodesValueNodeToVariant
(
pv
,
&
pFillCol
[
i
].
fillVal
);
}
if
(
pExprInfo
->
base
.
numOfParams
>
0
)
{
//
if (pExprInfo->base.numOfParams > 0) {
// pFillCol[i].flag = pExprInfo->base.pParam[0].pCol->flag; // always be the normal column for table query
}
//
}
}
for
(
int32_t
i
=
0
;
i
<
numOfNotFillExpr
;
++
i
)
{
...
...
tests/script/tsim/parser/fill_us.sim
浏览文件 @
a74c8301
...
...
@@ -1010,6 +1010,7 @@ if $data31 != 9.000000000 then
return -1
endi
if $data41 != 12.500000000 then
print expect 12.500000000, actual: $data41
return -1
endi
if $data51 != 16.000000000 then
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录