Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a74c8301
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,发现更多精彩内容 >>
提交
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 {
...
@@ -627,12 +627,15 @@ typedef struct SFillOperatorInfo {
int64_t
totalInputRows
;
int64_t
totalInputRows
;
void
**
p
;
void
**
p
;
SSDataBlock
*
existNewGroupBlock
;
SSDataBlock
*
existNewGroupBlock
;
bool
multigroupResult
;
STimeWindow
win
;
STimeWindow
win
;
SNode
*
pCondition
;
SNode
*
pCondition
;
SArray
*
pColMatchColInfo
;
SArray
*
pColMatchColInfo
;
int32_t
primaryTsCol
;
int32_t
primaryTsCol
;
uint64_t
curGroupId
;
// current handled group id
uint64_t
curGroupId
;
// current handled group id
SExprInfo
*
pExprInfo
;
int32_t
numOfExpr
;
SExprInfo
*
pNotFillExprInfo
;
int32_t
numOfNotFillExpr
;
}
SFillOperatorInfo
;
}
SFillOperatorInfo
;
typedef
struct
SGroupbyOperatorInfo
{
typedef
struct
SGroupbyOperatorInfo
{
...
...
source/libs/executor/inc/tfill.h
浏览文件 @
a74c8301
...
@@ -44,6 +44,7 @@ typedef struct SFillInfo {
...
@@ -44,6 +44,7 @@ typedef struct SFillInfo {
TSKEY
end
;
// endKey for fill
TSKEY
end
;
// endKey for fill
TSKEY
currentKey
;
// current active timestamp, the value may be changed during the fill procedure.
TSKEY
currentKey
;
// current active timestamp, the value may be changed during the fill procedure.
int32_t
tsSlotId
;
// primary time stamp slot id
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
order
;
// order [TSDB_ORDER_ASC|TSDB_ORDER_DESC]
int32_t
type
;
// fill type
int32_t
type
;
// fill type
int32_t
numOfRows
;
// number of rows in the input data block
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) {
...
@@ -3244,7 +3244,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
SSDataBlock
*
pBlock
=
pDownstream
->
fpSet
.
getNextFn
(
pDownstream
);
SSDataBlock
*
pBlock
=
pDownstream
->
fpSet
.
getNextFn
(
pDownstream
);
if
(
pBlock
==
NULL
)
{
if
(
pBlock
==
NULL
)
{
if
(
pInfo
->
totalInputRows
==
0
)
{
if
(
pInfo
->
totalInputRows
==
0
)
{
pOperator
->
status
=
OP_EXEC_DONE
;
doSetOperatorCompleted
(
pOperator
)
;
return
NULL
;
return
NULL
;
}
}
...
@@ -3252,6 +3252,9 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
...
@@ -3252,6 +3252,9 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
}
else
{
}
else
{
blockDataUpdateTsWindow
(
pBlock
,
pInfo
->
primaryTsCol
);
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
)
{
if
(
pInfo
->
curGroupId
==
0
||
pInfo
->
curGroupId
==
pBlock
->
info
.
groupId
)
{
pInfo
->
curGroupId
=
pBlock
->
info
.
groupId
;
// the first data block
pInfo
->
curGroupId
=
pBlock
->
info
.
groupId
;
// the first data block
...
@@ -3629,10 +3632,9 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
...
@@ -3629,10 +3632,9 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
goto
_error
;
goto
_error
;
}
}
int32_t
num
=
0
,
num1
=
0
;
SSDataBlock
*
pResBlock
=
createResDataBlock
(
pPhyFillNode
->
node
.
pOutputDataBlockDesc
);
SSDataBlock
*
pResBlock
=
createResDataBlock
(
pPhyFillNode
->
node
.
pOutputDataBlockDesc
);
SExprInfo
*
pExprInfo
=
createExprInfo
(
pPhyFillNode
->
pFillExprs
,
NULL
,
&
num
);
SExprInfo
*
pExprInfo
=
createExprInfo
(
pPhyFillNode
->
pFillExprs
,
NULL
,
&
pInfo
->
numOfExpr
);
SExprInfo
*
pCopyColumnExprInfo
=
createExprInfo
(
pPhyFillNode
->
pNotFillExprs
,
NULL
,
&
num1
);
SExprInfo
*
pCopyColumnExprInfo
=
createExprInfo
(
pPhyFillNode
->
pNotFillExprs
,
NULL
,
&
pInfo
->
numOfNotFillExpr
);
SInterval
*
pInterval
=
SInterval
*
pInterval
=
QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL
==
downstream
->
operatorType
QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL
==
downstream
->
operatorType
...
@@ -3645,6 +3647,7 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
...
@@ -3645,6 +3647,7 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
SResultInfo
*
pResultInfo
=
&
pOperator
->
resultInfo
;
SResultInfo
*
pResultInfo
=
&
pOperator
->
resultInfo
;
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
4096
);
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
4096
);
blockDataEnsureCapacity
(
pResBlock
,
pOperator
->
resultInfo
.
capacity
);
blockDataEnsureCapacity
(
pResBlock
,
pOperator
->
resultInfo
.
capacity
);
initExprSupp
(
&
pOperator
->
exprSupp
,
pExprInfo
,
pInfo
->
numOfExpr
);
pInfo
->
primaryTsCol
=
((
SColumnNode
*
)
pPhyFillNode
->
pWStartTs
)
->
slotId
;
pInfo
->
primaryTsCol
=
((
SColumnNode
*
)
pPhyFillNode
->
pWStartTs
)
->
slotId
;
...
@@ -3652,9 +3655,9 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
...
@@ -3652,9 +3655,9 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
SArray
*
pColMatchColInfo
=
extractColMatchInfo
(
pPhyFillNode
->
pFillExprs
,
pPhyFillNode
->
node
.
pOutputDataBlockDesc
,
SArray
*
pColMatchColInfo
=
extractColMatchInfo
(
pPhyFillNode
->
pFillExprs
,
pPhyFillNode
->
node
.
pOutputDataBlockDesc
,
&
numOfOutputCols
,
COL_MATCH_FROM_SLOT_ID
);
&
numOfOutputCols
,
COL_MATCH_FROM_SLOT_ID
);
int32_t
code
=
initFillInfo
(
pInfo
,
pExprInfo
,
num
,
pCopyColumnExprInfo
,
num1
,
int32_t
code
=
(
SNodeListNode
*
)
pPhyFillNode
->
pValues
,
pPhyFillNode
->
timeRange
,
initFillInfo
(
pInfo
,
pExprInfo
,
pInfo
->
numOfExpr
,
pCopyColumnExprInfo
,
pInfo
->
numOfNotFillExpr
,
(
SNodeListNode
*
)
pPhyFillNode
->
pValues
,
pResultInfo
->
capacity
,
pTaskInfo
->
id
.
str
,
pInterval
,
type
,
order
);
pPhyFillNode
->
timeRange
,
pResultInfo
->
capacity
,
pTaskInfo
->
id
.
str
,
pInterval
,
type
,
order
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
goto
_error
;
}
}
...
@@ -3667,7 +3670,7 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
...
@@ -3667,7 +3670,7 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_FILL
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_FILL
;
pOperator
->
exprSupp
.
pExprInfo
=
pExprInfo
;
pOperator
->
exprSupp
.
pExprInfo
=
pExprInfo
;
pOperator
->
exprSupp
.
numOfExprs
=
num
;
pOperator
->
exprSupp
.
numOfExprs
=
pInfo
->
numOfExpr
;
pOperator
->
info
=
pInfo
;
pOperator
->
info
=
pInfo
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
...
...
source/libs/executor/src/tfill.c
浏览文件 @
a74c8301
...
@@ -258,7 +258,7 @@ static void copyCurrentRowIntoBuf(SFillInfo* pFillInfo, int32_t rowIndex, SArray
...
@@ -258,7 +258,7 @@ static void copyCurrentRowIntoBuf(SFillInfo* pFillInfo, int32_t rowIndex, SArray
static
int32_t
fillResultImpl
(
SFillInfo
*
pFillInfo
,
SSDataBlock
*
pBlock
,
int32_t
outputRows
)
{
static
int32_t
fillResultImpl
(
SFillInfo
*
pFillInfo
,
SSDataBlock
*
pBlock
,
int32_t
outputRows
)
{
pFillInfo
->
numOfCurrent
=
0
;
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
);
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pFillInfo
->
order
);
bool
ascFill
=
FILL_IS_ASC_FILL
(
pFillInfo
);
bool
ascFill
=
FILL_IS_ASC_FILL
(
pFillInfo
);
...
@@ -349,10 +349,6 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t
...
@@ -349,10 +349,6 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t
}
}
if
(
pFillInfo
->
index
>=
pFillInfo
->
numOfRows
||
pFillInfo
->
numOfCurrent
>=
outputRows
)
{
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
;
pFillInfo
->
numOfTotal
+=
pFillInfo
->
numOfCurrent
;
return
pFillInfo
->
numOfCurrent
;
return
pFillInfo
->
numOfCurrent
;
}
}
...
@@ -413,7 +409,17 @@ struct SFillInfo* taosCreateFillInfo(TSKEY skey, int32_t numOfFillCols, int32_t
...
@@ -413,7 +409,17 @@ struct SFillInfo* taosCreateFillInfo(TSKEY skey, int32_t numOfFillCols, int32_t
}
}
pFillInfo
->
order
=
order
;
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
);
taosResetFillInfo
(
pFillInfo
,
skey
);
switch
(
fillType
)
{
switch
(
fillType
)
{
...
@@ -531,7 +537,7 @@ bool taosFillHasMoreResults(SFillInfo* pFillInfo) {
...
@@ -531,7 +537,7 @@ bool taosFillHasMoreResults(SFillInfo* pFillInfo) {
}
}
int64_t
getNumOfResultsAfterFillGap
(
SFillInfo
*
pFillInfo
,
TSKEY
ekey
,
int32_t
maxNumOfRows
)
{
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
;
int64_t
*
tsList
=
(
int64_t
*
)
pCol
->
pData
;
int32_t
numOfRows
=
taosNumOfRemainRows
(
pFillInfo
);
int32_t
numOfRows
=
taosNumOfRemainRows
(
pFillInfo
);
...
@@ -619,9 +625,9 @@ SFillColInfo* createFillColInfo(SExprInfo* pExpr, int32_t numOfFillExpr, SExprIn
...
@@ -619,9 +625,9 @@ SFillColInfo* createFillColInfo(SExprInfo* pExpr, int32_t numOfFillExpr, SExprIn
nodesValueNodeToVariant
(
pv
,
&
pFillCol
[
i
].
fillVal
);
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
// 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
)
{
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
...
@@ -1010,6 +1010,7 @@ if $data31 != 9.000000000 then
return -1
return -1
endi
endi
if $data41 != 12.500000000 then
if $data41 != 12.500000000 then
print expect 12.500000000, actual: $data41
return -1
return -1
endi
endi
if $data51 != 16.000000000 then
if $data51 != 16.000000000 then
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录