Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f8bd7789
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看板
提交
f8bd7789
编写于
8月 02, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: the fill physical scheme distinguishes between interpolated and non-interpolated expressions
上级
8ea865fe
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
131 addition
and
34 deletion
+131
-34
include/libs/nodes/plannodes.h
include/libs/nodes/plannodes.h
+4
-1
include/libs/nodes/querynodes.h
include/libs/nodes/querynodes.h
+8
-1
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+11
-9
source/libs/nodes/src/nodesCloneFuncs.c
source/libs/nodes/src/nodesCloneFuncs.c
+2
-0
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+14
-8
source/libs/nodes/src/nodesTraverseFuncs.c
source/libs/nodes/src/nodesTraverseFuncs.c
+2
-0
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+2
-1
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+69
-9
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+16
-2
source/libs/planner/test/planIntervalTest.cpp
source/libs/planner/test/planIntervalTest.cpp
+3
-2
source/util/src/terror.c
source/util/src/terror.c
+0
-1
未找到文件。
include/libs/nodes/plannodes.h
浏览文件 @
f8bd7789
...
...
@@ -211,6 +211,8 @@ typedef struct SWindowLogicNode {
typedef
struct
SFillLogicNode
{
SLogicNode
node
;
EFillMode
mode
;
SNodeList
*
pFillExprs
;
SNodeList
*
pNotFillExprs
;
SNode
*
pWStartTs
;
SNode
*
pValues
;
// SNodeListNode
STimeWindow
timeRange
;
...
...
@@ -435,9 +437,10 @@ typedef SIntervalPhysiNode SStreamSemiIntervalPhysiNode;
typedef
struct
SFillPhysiNode
{
SPhysiNode
node
;
EFillMode
mode
;
SNodeList
*
pFillExprs
;
SNodeList
*
pNotFillExprs
;
SNode
*
pWStartTs
;
// SColumnNode
SNode
*
pValues
;
// SNodeListNode
SNodeList
*
pTargets
;
STimeWindow
timeRange
;
EOrder
inputTsOrder
;
}
SFillPhysiNode
;
...
...
include/libs/nodes/querynodes.h
浏览文件 @
f8bd7789
...
...
@@ -53,7 +53,13 @@ typedef struct SExprNode {
bool
orderAlias
;
}
SExprNode
;
typedef
enum
EColumnType
{
COLUMN_TYPE_COLUMN
=
1
,
COLUMN_TYPE_TAG
,
COLUMN_TYPE_TBNAME
}
EColumnType
;
typedef
enum
EColumnType
{
COLUMN_TYPE_COLUMN
=
1
,
COLUMN_TYPE_TAG
,
COLUMN_TYPE_TBNAME
,
COLUMN_TYPE_WINDOW_PC
,
COLUMN_TYPE_GROUP_KEY
}
EColumnType
;
typedef
struct
SColumnNode
{
SExprNode
node
;
// QUERY_NODE_COLUMN
...
...
@@ -291,6 +297,7 @@ typedef enum ESqlClause {
SQL_CLAUSE_WHERE
,
SQL_CLAUSE_PARTITION_BY
,
SQL_CLAUSE_WINDOW
,
SQL_CLAUSE_FILL
,
SQL_CLAUSE_GROUP_BY
,
SQL_CLAUSE_HAVING
,
SQL_CLAUSE_DISTINCT
,
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
f8bd7789
...
...
@@ -3596,7 +3596,8 @@ void doDestroyExchangeOperatorInfo(void* param) {
}
static
int32_t
initFillInfo
(
SFillOperatorInfo
*
pInfo
,
SExprInfo
*
pExpr
,
int32_t
numOfCols
,
SNodeListNode
*
pValNode
,
STimeWindow
win
,
int32_t
capacity
,
const
char
*
id
,
SInterval
*
pInterval
,
int32_t
fillType
,
int32_t
order
)
{
STimeWindow
win
,
int32_t
capacity
,
const
char
*
id
,
SInterval
*
pInterval
,
int32_t
fillType
,
int32_t
order
)
{
SFillColInfo
*
pColInfo
=
createFillColInfo
(
pExpr
,
numOfCols
,
pValNode
);
STimeWindow
w
=
getAlignQueryTimeWindow
(
pInterval
,
pInterval
->
precision
,
win
.
skey
);
...
...
@@ -3627,13 +3628,13 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
int32_t
num
=
0
;
SSDataBlock
*
pResBlock
=
createResDataBlock
(
pPhyFillNode
->
node
.
pOutputDataBlockDesc
);
SExprInfo
*
pExprInfo
=
createExprInfo
(
pPhyFillNode
->
p
Target
s
,
NULL
,
&
num
);
SExprInfo
*
pExprInfo
=
createExprInfo
(
pPhyFillNode
->
p
FillExpr
s
,
NULL
,
&
num
);
SInterval
*
pInterval
=
QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL
==
downstream
->
operatorType
?
&
((
SMergeAlignedIntervalAggOperatorInfo
*
)
downstream
->
info
)
->
intervalAggOperatorInfo
->
interval
:
&
((
SIntervalAggOperatorInfo
*
)
downstream
->
info
)
->
interval
;
int32_t
order
=
(
pPhyFillNode
->
inputTsOrder
==
ORDER_ASC
)
?
TSDB_ORDER_ASC
:
TSDB_ORDER_DESC
;
int32_t
order
=
(
pPhyFillNode
->
inputTsOrder
==
ORDER_ASC
)
?
TSDB_ORDER_ASC
:
TSDB_ORDER_DESC
;
int32_t
type
=
convertFillType
(
pPhyFillNode
->
mode
);
SResultInfo
*
pResultInfo
=
&
pOperator
->
resultInfo
;
...
...
@@ -3641,7 +3642,7 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
pInfo
->
primaryTsCol
=
((
SColumnNode
*
)
pPhyFillNode
->
pWStartTs
)
->
slotId
;
int32_t
numOfOutputCols
=
0
;
SArray
*
pColMatchColInfo
=
extractColMatchInfo
(
pPhyFillNode
->
p
Target
s
,
pPhyFillNode
->
node
.
pOutputDataBlockDesc
,
SArray
*
pColMatchColInfo
=
extractColMatchInfo
(
pPhyFillNode
->
p
FillExpr
s
,
pPhyFillNode
->
node
.
pOutputDataBlockDesc
,
&
numOfOutputCols
,
COL_MATCH_FROM_SLOT_ID
);
int32_t
code
=
initFillInfo
(
pInfo
,
pExprInfo
,
num
,
(
SNodeListNode
*
)
pPhyFillNode
->
pValues
,
pPhyFillNode
->
timeRange
,
...
...
@@ -3835,7 +3836,7 @@ static int32_t sortTableGroup(STableListInfo* pTableListInfo, int32_t groupNum)
return
TDB_CODE_SUCCESS
;
}
bool
groupbyTbname
(
SNodeList
*
pGroupList
)
{
bool
groupbyTbname
(
SNodeList
*
pGroupList
)
{
bool
bytbname
=
false
;
if
(
LIST_LENGTH
(
pGroupList
)
>
0
)
{
SNode
*
p
=
nodesListGetNode
(
pGroupList
,
0
);
...
...
@@ -3877,7 +3878,7 @@ int32_t generateGroupIdMap(STableListInfo* pTableListInfo, SReadHandle* pHandle,
bool
assignUid
=
groupbyTbname
(
group
);
int32_t
groupNum
=
0
;
size_t
numOfTables
=
taosArrayGetSize
(
pTableListInfo
->
pTableList
);
size_t
numOfTables
=
taosArrayGetSize
(
pTableListInfo
->
pTableList
);
for
(
int32_t
i
=
0
;
i
<
numOfTables
;
i
++
)
{
STableKeyInfo
*
info
=
taosArrayGet
(
pTableListInfo
->
pTableList
,
i
);
...
...
@@ -4619,7 +4620,7 @@ void releaseQueryBuf(size_t numOfTables) {
}
int32_t
getOperatorExplainExecInfo
(
SOperatorInfo
*
operatorInfo
,
SArray
*
pExecInfoList
)
{
SExplainExecInfo
execInfo
=
{
0
};
SExplainExecInfo
execInfo
=
{
0
};
SExplainExecInfo
*
pExplainInfo
=
taosArrayPush
(
pExecInfoList
,
&
execInfo
);
pExplainInfo
->
numOfRows
=
operatorInfo
->
resultInfo
.
totalRows
;
...
...
@@ -4629,7 +4630,8 @@ int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SArray* pExecInf
pExplainInfo
->
verboseInfo
=
NULL
;
if
(
operatorInfo
->
fpSet
.
getExplainFn
)
{
int32_t
code
=
operatorInfo
->
fpSet
.
getExplainFn
(
operatorInfo
,
&
pExplainInfo
->
verboseInfo
,
&
pExplainInfo
->
verboseLen
);
int32_t
code
=
operatorInfo
->
fpSet
.
getExplainFn
(
operatorInfo
,
&
pExplainInfo
->
verboseInfo
,
&
pExplainInfo
->
verboseLen
);
if
(
code
)
{
qError
(
"%s operator getExplainFn failed, code:%s"
,
GET_TASKID
(
operatorInfo
->
pTaskInfo
),
tstrerror
(
code
));
return
code
;
...
...
@@ -4640,7 +4642,7 @@ int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SArray* pExecInf
for
(
int32_t
i
=
0
;
i
<
operatorInfo
->
numOfDownstream
;
++
i
)
{
code
=
getOperatorExplainExecInfo
(
operatorInfo
->
pDownstream
[
i
],
pExecInfoList
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// taosMemoryFreeClear(*pRes);
// taosMemoryFreeClear(*pRes);
return
TSDB_CODE_QRY_OUT_OF_MEMORY
;
}
}
...
...
source/libs/nodes/src/nodesCloneFuncs.c
浏览文件 @
f8bd7789
...
...
@@ -450,6 +450,8 @@ static int32_t logicWindowCopy(const SWindowLogicNode* pSrc, SWindowLogicNode* p
static
int32_t
logicFillCopy
(
const
SFillLogicNode
*
pSrc
,
SFillLogicNode
*
pDst
)
{
COPY_BASE_OBJECT_FIELD
(
node
,
logicNodeCopy
);
COPY_SCALAR_FIELD
(
mode
);
CLONE_NODE_LIST_FIELD
(
pFillExprs
);
CLONE_NODE_LIST_FIELD
(
pNotFillExprs
);
CLONE_NODE_FIELD
(
pWStartTs
);
CLONE_NODE_FIELD
(
pValues
);
COPY_OBJECT_FIELD
(
timeRange
,
sizeof
(
STimeWindow
));
...
...
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
f8bd7789
...
...
@@ -2062,9 +2062,10 @@ static int32_t jsonToPhysiIntervalNode(const SJson* pJson, void* pObj) {
}
static
const
char
*
jkFillPhysiPlanMode
=
"Mode"
;
static
const
char
*
jkFillPhysiPlanFillExprs
=
"FillExprs"
;
static
const
char
*
jkFillPhysiPlanNotFillExprs
=
"NotFillExprs"
;
static
const
char
*
jkFillPhysiPlanWStartTs
=
"WStartTs"
;
static
const
char
*
jkFillPhysiPlanValues
=
"Values"
;
static
const
char
*
jkFillPhysiPlanTargets
=
"Targets"
;
static
const
char
*
jkFillPhysiPlanStartTime
=
"StartTime"
;
static
const
char
*
jkFillPhysiPlanEndTime
=
"EndTime"
;
static
const
char
*
jkFillPhysiPlanInputTsOrder
=
"inputTsOrder"
;
...
...
@@ -2077,13 +2078,16 @@ static int32_t physiFillNodeToJson(const void* pObj, SJson* pJson) {
code
=
tjsonAddIntegerToObject
(
pJson
,
jkFillPhysiPlanMode
,
pNode
->
mode
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddObject
(
pJson
,
jkFillPhysiPlanWStartTs
,
nodeToJson
,
pNode
->
pWStartT
s
);
code
=
nodeListToJson
(
pJson
,
jkFillPhysiPlanFillExprs
,
pNode
->
pFillExpr
s
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddObject
(
pJson
,
jkFillPhysiPlanValues
,
nodeToJson
,
pNode
->
pValue
s
);
code
=
nodeListToJson
(
pJson
,
jkFillPhysiPlanNotFillExprs
,
pNode
->
pNotFillExpr
s
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
nodeListToJson
(
pJson
,
jkFillPhysiPlanTargets
,
pNode
->
pTargets
);
code
=
tjsonAddObject
(
pJson
,
jkFillPhysiPlanWStartTs
,
nodeToJson
,
pNode
->
pWStartTs
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddObject
(
pJson
,
jkFillPhysiPlanValues
,
nodeToJson
,
pNode
->
pValues
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddIntegerToObject
(
pJson
,
jkFillPhysiPlanStartTime
,
pNode
->
timeRange
.
skey
);
...
...
@@ -2104,16 +2108,18 @@ static int32_t jsonToPhysiFillNode(const SJson* pJson, void* pObj) {
int32_t
code
=
jsonToPhysicPlanNode
(
pJson
,
pObj
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkFillPhysiPlanMode
,
pNode
->
mode
,
code
);
;
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNode
Object
(
pJson
,
jkFillPhysiPlanWStartTs
,
&
pNode
->
pWStartT
s
);
code
=
jsonToNode
List
(
pJson
,
jkFillPhysiPlanFillExprs
,
&
pNode
->
pFillExpr
s
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkFillPhysiPlanValues
,
&
pNode
->
pValues
);
code
=
jsonToNodeList
(
pJson
,
jkFillPhysiPlanNotFillExprs
,
&
pNode
->
pNotFillExprs
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkFillPhysiPlanWStartTs
,
&
pNode
->
pWStartTs
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNode
List
(
pJson
,
jkFillPhysiPlanTargets
,
&
pNode
->
pTarget
s
);
code
=
jsonToNode
Object
(
pJson
,
jkFillPhysiPlanValues
,
&
pNode
->
pValue
s
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonGetBigIntValue
(
pJson
,
jkFillPhysiPlanStartTime
,
&
pNode
->
timeRange
.
skey
);
...
...
source/libs/nodes/src/nodesTraverseFuncs.c
浏览文件 @
f8bd7789
...
...
@@ -346,6 +346,7 @@ void nodesWalkSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeWalker wa
if
(
NULL
!=
pSelect
->
pWindow
&&
QUERY_NODE_INTERVAL_WINDOW
==
nodeType
(
pSelect
->
pWindow
))
{
nodesWalkExpr
(((
SIntervalWindowNode
*
)
pSelect
->
pWindow
)
->
pFill
,
walker
,
pContext
);
}
case
SQL_CLAUSE_FILL
:
nodesWalkExprs
(
pSelect
->
pGroupByList
,
walker
,
pContext
);
case
SQL_CLAUSE_GROUP_BY
:
nodesWalkExpr
(
pSelect
->
pHaving
,
walker
,
pContext
);
...
...
@@ -379,6 +380,7 @@ void nodesRewriteSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeRewrit
if
(
NULL
!=
pSelect
->
pWindow
&&
QUERY_NODE_INTERVAL_WINDOW
==
nodeType
(
pSelect
->
pWindow
))
{
nodesRewriteExpr
(
&
(((
SIntervalWindowNode
*
)
pSelect
->
pWindow
)
->
pFill
),
rewriter
,
pContext
);
}
case
SQL_CLAUSE_FILL
:
nodesRewriteExprs
(
pSelect
->
pGroupByList
,
rewriter
,
pContext
);
case
SQL_CLAUSE_GROUP_BY
:
nodesRewriteExpr
(
&
(
pSelect
->
pHaving
),
rewriter
,
pContext
);
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
f8bd7789
...
...
@@ -931,9 +931,10 @@ void nodesDestroyNode(SNode* pNode) {
case
QUERY_NODE_PHYSICAL_PLAN_FILL
:
{
SFillPhysiNode
*
pPhyNode
=
(
SFillPhysiNode
*
)
pNode
;
destroyPhysiNode
((
SPhysiNode
*
)
pPhyNode
);
nodesDestroyList
(
pPhyNode
->
pFillExprs
);
nodesDestroyList
(
pPhyNode
->
pNotFillExprs
);
nodesDestroyNode
(
pPhyNode
->
pWStartTs
);
nodesDestroyNode
(
pPhyNode
->
pValues
);
nodesDestroyList
(
pPhyNode
->
pTargets
);
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION
:
...
...
source/libs/planner/src/planLogicCreater.c
浏览文件 @
f8bd7789
...
...
@@ -38,6 +38,27 @@ typedef struct SRewriteExprCxt {
SNodeList
*
pExprs
;
}
SRewriteExprCxt
;
static
void
setColumnInfo
(
SFunctionNode
*
pFunc
,
SColumnNode
*
pCol
)
{
switch
(
pFunc
->
funcType
)
{
case
FUNCTION_TYPE_TBNAME
:
pCol
->
colType
=
COLUMN_TYPE_TBNAME
;
break
;
case
FUNCTION_TYPE_WSTART
:
case
FUNCTION_TYPE_WEND
:
pCol
->
colId
=
PRIMARYKEY_TIMESTAMP_COL_ID
;
pCol
->
colType
=
COLUMN_TYPE_WINDOW_PC
;
break
;
case
FUNCTION_TYPE_WDURATION
:
pCol
->
colType
=
COLUMN_TYPE_WINDOW_PC
;
break
;
case
FUNCTION_TYPE_GROUP_KEY
:
pCol
->
colType
=
COLUMN_TYPE_GROUP_KEY
;
break
;
default:
break
;
}
}
static
EDealRes
doRewriteExpr
(
SNode
**
pNode
,
void
*
pContext
)
{
switch
(
nodeType
(
*
pNode
))
{
case
QUERY_NODE_OPERATOR
:
...
...
@@ -60,11 +81,7 @@ static EDealRes doRewriteExpr(SNode** pNode, void* pContext) {
strcpy
(
pCol
->
node
.
aliasName
,
pToBeRewrittenExpr
->
aliasName
);
strcpy
(
pCol
->
colName
,
((
SExprNode
*
)
pExpr
)
->
aliasName
);
if
(
QUERY_NODE_FUNCTION
==
nodeType
(
pExpr
))
{
if
(
FUNCTION_TYPE_WSTART
==
((
SFunctionNode
*
)
pExpr
)
->
funcType
)
{
pCol
->
colId
=
PRIMARYKEY_TIMESTAMP_COL_ID
;
}
else
if
(
FUNCTION_TYPE_TBNAME
==
((
SFunctionNode
*
)
pExpr
)
->
funcType
)
{
pCol
->
colType
=
COLUMN_TYPE_TBNAME
;
}
setColumnInfo
((
SFunctionNode
*
)
pExpr
,
pCol
);
}
nodesDestroyNode
(
*
pNode
);
*
pNode
=
(
SNode
*
)
pCol
;
...
...
@@ -746,6 +763,41 @@ static int32_t createWindowLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSele
return
TSDB_CODE_FAILED
;
}
static
EDealRes
needFillValueImpl
(
SNode
*
pNode
,
void
*
pContext
)
{
if
(
QUERY_NODE_COLUMN
==
nodeType
(
pNode
))
{
SColumnNode
*
pCol
=
(
SColumnNode
*
)
pNode
;
if
(
COLUMN_TYPE_WINDOW_PC
!=
pCol
->
colType
&&
COLUMN_TYPE_GROUP_KEY
!=
pCol
->
colType
)
{
*
(
bool
*
)
pContext
=
true
;
return
DEAL_RES_END
;
}
}
return
DEAL_RES_CONTINUE
;
}
static
bool
needFillValue
(
SNode
*
pNode
)
{
bool
hasFillCol
=
false
;
nodesWalkExpr
(
pNode
,
needFillValueImpl
,
&
hasFillCol
);
return
hasFillCol
;
}
static
int32_t
partFillExprs
(
SNodeList
*
pProjectionList
,
SNodeList
**
pFillExprs
,
SNodeList
**
pNotFillExprs
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
SNode
*
pProject
=
NULL
;
FOREACH
(
pProject
,
pProjectionList
)
{
if
(
needFillValue
(
pProject
))
{
code
=
nodesListMakeStrictAppend
(
pFillExprs
,
nodesCloneNode
(
pProject
));
}
else
{
code
=
nodesListMakeStrictAppend
(
pNotFillExprs
,
nodesCloneNode
(
pProject
));
}
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
NODES_DESTORY_LIST
(
*
pFillExprs
);
NODES_DESTORY_LIST
(
*
pNotFillExprs
);
break
;
}
}
return
code
;
}
static
int32_t
createFillLogicNode
(
SLogicPlanContext
*
pCxt
,
SSelectStmt
*
pSelect
,
SLogicNode
**
pLogicNode
)
{
if
(
NULL
==
pSelect
->
pWindow
||
QUERY_NODE_INTERVAL_WINDOW
!=
nodeType
(
pSelect
->
pWindow
)
||
NULL
==
((
SIntervalWindowNode
*
)
pSelect
->
pWindow
)
->
pFill
)
{
...
...
@@ -767,10 +819,18 @@ static int32_t createFillLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
pFill
->
node
.
resultDataOrder
=
DATA_ORDER_LEVEL_IN_GROUP
;
pFill
->
inputTsOrder
=
ORDER_ASC
;
int32_t
code
=
nodesCollectColumns
(
pSelect
,
SQL_CLAUSE_WINDOW
,
NULL
,
COLLECT_COL_TYPE_ALL
,
&
pFill
->
node
.
pTargets
);
if
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
==
pFill
->
node
.
pTargets
)
{
code
=
nodesListMakeStrictAppend
(
&
pFill
->
node
.
pTargets
,
nodesCloneNode
(
nodesListGetNode
(
pCxt
->
pCurrRoot
->
pTargets
,
0
)));
int32_t
code
=
partFillExprs
(
pSelect
->
pProjectionList
,
&
pFill
->
pFillExprs
,
&
pFill
->
pNotFillExprs
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
rewriteExprsForSelect
(
pFill
->
pFillExprs
,
pSelect
,
SQL_CLAUSE_FILL
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
rewriteExprsForSelect
(
pFill
->
pNotFillExprs
,
pSelect
,
SQL_CLAUSE_FILL
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
createColumnByRewriteExprs
(
pFill
->
pFillExprs
,
&
pFill
->
node
.
pTargets
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
createColumnByRewriteExprs
(
pFill
->
pNotFillExprs
,
&
pFill
->
node
.
pTargets
);
}
pFill
->
mode
=
pFillNode
->
mode
;
...
...
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
f8bd7789
...
...
@@ -311,6 +311,10 @@ static EDealRes doSetSlotId(SNode* pNode, void* pContext) {
static
int32_t
setNodeSlotId
(
SPhysiPlanContext
*
pCxt
,
int16_t
leftDataBlockId
,
int16_t
rightDataBlockId
,
SNode
*
pNode
,
SNode
**
pOutput
)
{
if
(
NULL
==
pNode
)
{
return
TSDB_CODE_SUCCESS
;
}
SNode
*
pRes
=
nodesCloneNode
(
pNode
);
if
(
NULL
==
pRes
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -332,6 +336,10 @@ static int32_t setNodeSlotId(SPhysiPlanContext* pCxt, int16_t leftDataBlockId, i
static
int32_t
setListSlotId
(
SPhysiPlanContext
*
pCxt
,
int16_t
leftDataBlockId
,
int16_t
rightDataBlockId
,
const
SNodeList
*
pList
,
SNodeList
**
pOutput
)
{
if
(
NULL
==
pList
)
{
return
TSDB_CODE_SUCCESS
;
}
SNodeList
*
pRes
=
nodesCloneList
(
pList
);
if
(
NULL
==
pRes
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -1368,9 +1376,15 @@ static int32_t createFillPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren
pFill
->
inputTsOrder
=
pFillNode
->
inputTsOrder
;
SDataBlockDescNode
*
pChildTupe
=
(((
SPhysiNode
*
)
nodesListGetNode
(
pChildren
,
0
))
->
pOutputDataBlockDesc
);
int32_t
code
=
setListSlotId
(
pCxt
,
pChildTupe
->
dataBlockId
,
-
1
,
pFillNode
->
node
.
pTargets
,
&
pFill
->
pTargets
);
int32_t
code
=
setListSlotId
(
pCxt
,
pChildTupe
->
dataBlockId
,
-
1
,
pFillNode
->
pFillExprs
,
&
pFill
->
pFillExprs
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
addDataBlockSlots
(
pCxt
,
pFill
->
pFillExprs
,
pFill
->
node
.
pOutputDataBlockDesc
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
setListSlotId
(
pCxt
,
pChildTupe
->
dataBlockId
,
-
1
,
pFillNode
->
pNotFillExprs
,
&
pFill
->
pNotFillExprs
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
addDataBlockSlots
(
pCxt
,
pFill
->
p
Target
s
,
pFill
->
node
.
pOutputDataBlockDesc
);
code
=
addDataBlockSlots
(
pCxt
,
pFill
->
p
NotFillExpr
s
,
pFill
->
node
.
pOutputDataBlockDesc
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
...
...
source/libs/planner/test/planIntervalTest.cpp
浏览文件 @
f8bd7789
...
...
@@ -45,8 +45,9 @@ TEST_F(PlanIntervalTest, fill) {
"WHERE ts > TIMESTAMP '2022-04-01 00:00:00' and ts < TIMESTAMP '2022-04-30 23:59:59' "
"INTERVAL(10s) FILL(VALUE, 10, 20)"
);
run
(
"SELECT COUNT(*) FROM st1 WHERE ts > TIMESTAMP '2022-04-01 00:00:00' and ts < TIMESTAMP '2022-04-30 23:59:59' "
"PARTITION BY TBNAME interval(10s) fill(prev)"
);
run
(
"SELECT _WSTART, TBNAME, COUNT(*) FROM st1 "
"WHERE ts > '2022-04-01 00:00:00' and ts < '2022-04-30 23:59:59' "
"PARTITION BY TBNAME INTERVAL(10s) FILL(PREV)"
);
}
TEST_F
(
PlanIntervalTest
,
selectFunc
)
{
...
...
source/util/src/terror.c
浏览文件 @
f8bd7789
...
...
@@ -463,7 +463,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_FS_APP_ERROR, "tfs out of memory")
TAOS_DEFINE_ERROR
(
TSDB_CODE_CTG_INTERNAL_ERROR
,
"catalog internal error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_CTG_INVALID_INPUT
,
"invalid catalog input parameters"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_CTG_NOT_READY
,
"catalog is not ready"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_OUT_OF_MEMORY
,
"catalog memory error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_CTG_SYS_ERROR
,
"catalog system error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_CTG_DB_DROPPED
,
"Database is dropped"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_CTG_OUT_OF_SERVICE
,
"catalog is out of service"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录