Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
83efe34b
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1183
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
83efe34b
编写于
5月 20, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: reserved aggregate function constant parameters
上级
b0c6118f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
169 addition
and
24 deletion
+169
-24
include/libs/nodes/nodes.h
include/libs/nodes/nodes.h
+5
-4
include/libs/nodes/querynodes.h
include/libs/nodes/querynodes.h
+4
-0
source/libs/nodes/src/nodesCloneFuncs.c
source/libs/nodes/src/nodesCloneFuncs.c
+139
-15
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+6
-0
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+2
-0
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+13
-5
未找到文件。
include/libs/nodes/nodes.h
浏览文件 @
83efe34b
...
...
@@ -59,10 +59,10 @@ extern "C" {
for (SListCell* cell = (NULL != (list) ? (list)->pHead : NULL); \
(NULL != cell ? (node = &(cell->pNode), true) : (node = NULL, false)); cell = cell->pNext)
#define DESTORY_LIST(list) \
do { \
nodesDestroyList(
list
); \
list
= NULL; \
#define DESTORY_LIST(list)
\
do {
\
nodesDestroyList(
(list)
); \
(list)
= NULL; \
} while (0)
typedef
enum
ENodeType
{
...
...
@@ -96,6 +96,7 @@ typedef enum ENodeType {
QUERY_NODE_EXPLAIN_OPTIONS
,
QUERY_NODE_STREAM_OPTIONS
,
QUERY_NODE_TOPIC_OPTIONS
,
QUERY_NODE_LEFT_VALUE
,
// Statement nodes are used in parser and planner module.
QUERY_NODE_SET_OPERATOR
,
...
...
include/libs/nodes/querynodes.h
浏览文件 @
83efe34b
...
...
@@ -93,6 +93,10 @@ typedef struct SValueNode {
char
unit
;
}
SValueNode
;
typedef
struct
SLeftValueNode
{
ENodeType
type
;
}
SLeftValueNode
;
typedef
struct
SOperatorNode
{
SExprNode
node
;
// QUERY_NODE_OPERATOR
EOperatorType
opType
;
...
...
source/libs/nodes/src/nodesCloneFuncs.c
浏览文件 @
83efe34b
...
...
@@ -19,6 +19,21 @@
#include "taos.h"
#include "taoserror.h"
#define COPY_SCALAR_FIELD(fldname) \
do { \
(pDst)->fldname = (pSrc)->fldname; \
} while (0)
#define COPY_CHAR_ARRAY_FIELD(fldname) \
do { \
strcpy((pDst)->fldname, (pSrc)->fldname); \
} while (0)
#define COPY_OBJECT_FIELD(fldname, size) \
do { \
memcpy(&((pDst)->fldname), &((pSrc)->fldname), size); \
} while (0)
#define COPY_CHAR_POINT_FIELD(fldname) \
do { \
if (NULL == (pSrc)->fldname) { \
...
...
@@ -70,27 +85,60 @@
} \
} while (0)
static
void
dataTypeCopy
(
const
SDataType
*
pSrc
,
SDataType
*
pDst
)
{}
static
SNode
*
exprNodeCopy
(
const
SExprNode
*
pSrc
,
SExprNode
*
pDst
)
{
dataTypeCopy
(
&
pSrc
->
resType
,
&
pDst
->
resType
);
pDst
->
pAssociation
=
NULL
;
COPY_OBJECT_FIELD
(
resType
,
sizeof
(
SDataType
));
COPY_CHAR_ARRAY_FIELD
(
aliasName
);
COPY_CHAR_ARRAY_FIELD
(
userAlias
);
return
(
SNode
*
)
pDst
;
}
static
SNode
*
columnNodeCopy
(
const
SColumnNode
*
pSrc
,
SColumnNode
*
pDst
)
{
COPY_BASE_OBJECT_FIELD
(
node
,
exprNodeCopy
);
pDst
->
pProjectRef
=
NULL
;
COPY_SCALAR_FIELD
(
tableId
);
COPY_SCALAR_FIELD
(
tableType
);
COPY_SCALAR_FIELD
(
colId
);
COPY_SCALAR_FIELD
(
colType
);
COPY_CHAR_ARRAY_FIELD
(
dbName
);
COPY_CHAR_ARRAY_FIELD
(
tableName
);
COPY_CHAR_ARRAY_FIELD
(
tableAlias
);
COPY_CHAR_ARRAY_FIELD
(
colName
);
COPY_SCALAR_FIELD
(
dataBlockId
);
COPY_SCALAR_FIELD
(
slotId
);
return
(
SNode
*
)
pDst
;
}
static
SNode
*
valueNodeCopy
(
const
SValueNode
*
pSrc
,
SValueNode
*
pDst
)
{
COPY_BASE_OBJECT_FIELD
(
node
,
exprNodeCopy
);
COPY_CHAR_POINT_FIELD
(
literal
);
COPY_SCALAR_FIELD
(
isDuration
);
COPY_SCALAR_FIELD
(
translate
);
COPY_SCALAR_FIELD
(
placeholderNo
);
COPY_SCALAR_FIELD
(
typeData
);
COPY_SCALAR_FIELD
(
unit
);
if
(
!
pSrc
->
translate
)
{
return
(
SNode
*
)
pDst
;
}
switch
(
pSrc
->
node
.
resType
.
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
COPY_SCALAR_FIELD
(
datum
.
b
);
break
;
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
COPY_SCALAR_FIELD
(
datum
.
i
);
break
;
case
TSDB_DATA_TYPE_FLOAT
:
case
TSDB_DATA_TYPE_DOUBLE
:
COPY_SCALAR_FIELD
(
datum
.
d
);
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
case
TSDB_DATA_TYPE_USMALLINT
:
case
TSDB_DATA_TYPE_UINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
COPY_SCALAR_FIELD
(
datum
.
u
);
break
;
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_VARCHAR
:
case
TSDB_DATA_TYPE_VARBINARY
:
...
...
@@ -104,7 +152,7 @@ static SNode* valueNodeCopy(const SValueNode* pSrc, SValueNode* pDst) {
case
TSDB_DATA_TYPE_JSON
:
case
TSDB_DATA_TYPE_DECIMAL
:
case
TSDB_DATA_TYPE_BLOB
:
// todo
case
TSDB_DATA_TYPE_MEDIUMBLOB
:
default:
break
;
}
...
...
@@ -113,6 +161,7 @@ static SNode* valueNodeCopy(const SValueNode* pSrc, SValueNode* pDst) {
static
SNode
*
operatorNodeCopy
(
const
SOperatorNode
*
pSrc
,
SOperatorNode
*
pDst
)
{
COPY_BASE_OBJECT_FIELD
(
node
,
exprNodeCopy
);
COPY_SCALAR_FIELD
(
opType
);
CLONE_NODE_FIELD
(
pLeft
);
CLONE_NODE_FIELD
(
pRight
);
return
(
SNode
*
)
pDst
;
...
...
@@ -120,18 +169,27 @@ static SNode* operatorNodeCopy(const SOperatorNode* pSrc, SOperatorNode* pDst) {
static
SNode
*
logicConditionNodeCopy
(
const
SLogicConditionNode
*
pSrc
,
SLogicConditionNode
*
pDst
)
{
COPY_BASE_OBJECT_FIELD
(
node
,
exprNodeCopy
);
COPY_SCALAR_FIELD
(
condType
);
CLONE_NODE_LIST_FIELD
(
pParameterList
);
return
(
SNode
*
)
pDst
;
}
static
SNode
*
functionNodeCopy
(
const
SFunctionNode
*
pSrc
,
SFunctionNode
*
pDst
)
{
COPY_BASE_OBJECT_FIELD
(
node
,
exprNodeCopy
);
COPY_CHAR_ARRAY_FIELD
(
functionName
);
COPY_SCALAR_FIELD
(
funcId
);
COPY_SCALAR_FIELD
(
funcType
);
CLONE_NODE_LIST_FIELD
(
pParameterList
);
COPY_SCALAR_FIELD
(
udfBufSize
);
return
(
SNode
*
)
pDst
;
}
static
SNode
*
tableNodeCopy
(
const
STableNode
*
pSrc
,
STableNode
*
pDst
)
{
COPY_BASE_OBJECT_FIELD
(
node
,
exprNodeCopy
);
COPY_CHAR_ARRAY_FIELD
(
dbName
);
COPY_CHAR_ARRAY_FIELD
(
tableName
);
COPY_CHAR_ARRAY_FIELD
(
tableAlias
);
COPY_SCALAR_FIELD
(
precision
);
return
(
SNode
*
)
pDst
;
}
...
...
@@ -159,6 +217,8 @@ static SNode* realTableNodeCopy(const SRealTableNode* pSrc, SRealTableNode* pDst
COPY_BASE_OBJECT_FIELD
(
table
,
tableNodeCopy
);
CLONE_OBJECT_FIELD
(
pMeta
,
tableMetaClone
);
CLONE_OBJECT_FIELD
(
pVgroupList
,
vgroupsInfoClone
);
COPY_CHAR_ARRAY_FIELD
(
qualDbName
);
COPY_SCALAR_FIELD
(
ratio
);
return
(
SNode
*
)
pDst
;
}
...
...
@@ -170,6 +230,7 @@ static SNode* tempTableNodeCopy(const STempTableNode* pSrc, STempTableNode* pDst
static
SNode
*
joinTableNodeCopy
(
const
SJoinTableNode
*
pSrc
,
SJoinTableNode
*
pDst
)
{
COPY_BASE_OBJECT_FIELD
(
table
,
tableNodeCopy
);
COPY_SCALAR_FIELD
(
joinType
);
CLONE_NODE_FIELD
(
pLeft
);
CLONE_NODE_FIELD
(
pRight
);
CLONE_NODE_FIELD
(
pOnCond
);
...
...
@@ -177,21 +238,30 @@ static SNode* joinTableNodeCopy(const SJoinTableNode* pSrc, SJoinTableNode* pDst
}
static
SNode
*
targetNodeCopy
(
const
STargetNode
*
pSrc
,
STargetNode
*
pDst
)
{
COPY_SCALAR_FIELD
(
dataBlockId
);
COPY_SCALAR_FIELD
(
slotId
);
CLONE_NODE_FIELD
(
pExpr
);
return
(
SNode
*
)
pDst
;
}
static
SNode
*
groupingSetNodeCopy
(
const
SGroupingSetNode
*
pSrc
,
SGroupingSetNode
*
pDst
)
{
COPY_SCALAR_FIELD
(
groupingSetType
);
CLONE_NODE_LIST_FIELD
(
pParameterList
);
return
(
SNode
*
)
pDst
;
}
static
SNode
*
orderByExprNodeCopy
(
const
SOrderByExprNode
*
pSrc
,
SOrderByExprNode
*
pDst
)
{
CLONE_NODE_FIELD
(
pExpr
);
COPY_SCALAR_FIELD
(
order
);
COPY_SCALAR_FIELD
(
nullOrder
);
return
(
SNode
*
)
pDst
;
}
static
SNode
*
limitNodeCopy
(
const
SLimitNode
*
pSrc
,
SLimitNode
*
pDst
)
{
return
(
SNode
*
)
pDst
;
}
static
SNode
*
limitNodeCopy
(
const
SLimitNode
*
pSrc
,
SLimitNode
*
pDst
)
{
COPY_SCALAR_FIELD
(
limit
);
COPY_SCALAR_FIELD
(
offset
);
return
(
SNode
*
)
pDst
;
}
static
SNode
*
stateWindowNodeCopy
(
const
SStateWindowNode
*
pSrc
,
SStateWindowNode
*
pDst
)
{
CLONE_NODE_FIELD
(
pCol
);
...
...
@@ -215,13 +285,16 @@ static SNode* intervalWindowNodeCopy(const SIntervalWindowNode* pSrc, SIntervalW
}
static
SNode
*
nodeListNodeCopy
(
const
SNodeListNode
*
pSrc
,
SNodeListNode
*
pDst
)
{
COPY_OBJECT_FIELD
(
dataType
,
sizeof
(
SDataType
));
CLONE_NODE_LIST_FIELD
(
pNodeList
);
return
(
SNode
*
)
pDst
;
}
static
SNode
*
fillNodeCopy
(
const
SFillNode
*
pSrc
,
SFillNode
*
pDst
)
{
COPY_SCALAR_FIELD
(
mode
);
CLONE_NODE_FIELD
(
pValues
);
CLONE_NODE_FIELD
(
pWStartTs
);
COPY_OBJECT_FIELD
(
timeRange
,
sizeof
(
STimeWindow
));
return
(
SNode
*
)
pDst
;
}
...
...
@@ -229,7 +302,7 @@ static SNode* logicNodeCopy(const SLogicNode* pSrc, SLogicNode* pDst) {
CLONE_NODE_LIST_FIELD
(
pTargets
);
CLONE_NODE_FIELD
(
pConditions
);
CLONE_NODE_LIST_FIELD
(
pChildren
);
pDst
->
pParent
=
NULL
;
COPY_SCALAR_FIELD
(
optimizedFlag
)
;
return
(
SNode
*
)
pDst
;
}
...
...
@@ -239,12 +312,25 @@ static SNode* logicScanCopy(const SScanLogicNode* pSrc, SScanLogicNode* pDst) {
CLONE_NODE_LIST_FIELD
(
pScanPseudoCols
);
CLONE_OBJECT_FIELD
(
pMeta
,
tableMetaClone
);
CLONE_OBJECT_FIELD
(
pVgroupList
,
vgroupsInfoClone
);
COPY_SCALAR_FIELD
(
scanType
);
COPY_OBJECT_FIELD
(
scanSeq
[
0
],
sizeof
(
uint8_t
)
*
2
);
COPY_OBJECT_FIELD
(
scanRange
,
sizeof
(
STimeWindow
));
COPY_OBJECT_FIELD
(
tableName
,
sizeof
(
SName
));
COPY_SCALAR_FIELD
(
showRewrite
);
COPY_SCALAR_FIELD
(
ratio
);
CLONE_NODE_LIST_FIELD
(
pDynamicScanFuncs
);
COPY_SCALAR_FIELD
(
dataRequired
);
COPY_SCALAR_FIELD
(
interval
);
COPY_SCALAR_FIELD
(
offset
);
COPY_SCALAR_FIELD
(
sliding
);
COPY_SCALAR_FIELD
(
intervalUnit
);
COPY_SCALAR_FIELD
(
slidingUnit
);
return
(
SNode
*
)
pDst
;
}
static
SNode
*
logicJoinCopy
(
const
SJoinLogicNode
*
pSrc
,
SJoinLogicNode
*
pDst
)
{
COPY_BASE_OBJECT_FIELD
(
node
,
logicNodeCopy
);
COPY_SCALAR_FIELD
(
joinType
);
CLONE_NODE_FIELD
(
pOnConditions
);
return
(
SNode
*
)
pDst
;
}
...
...
@@ -259,32 +345,50 @@ static SNode* logicAggCopy(const SAggLogicNode* pSrc, SAggLogicNode* pDst) {
static
SNode
*
logicProjectCopy
(
const
SProjectLogicNode
*
pSrc
,
SProjectLogicNode
*
pDst
)
{
COPY_BASE_OBJECT_FIELD
(
node
,
logicNodeCopy
);
CLONE_NODE_LIST_FIELD
(
pProjections
);
COPY_CHAR_ARRAY_FIELD
(
stmtName
);
COPY_SCALAR_FIELD
(
limit
);
COPY_SCALAR_FIELD
(
offset
);
COPY_SCALAR_FIELD
(
slimit
);
COPY_SCALAR_FIELD
(
soffset
);
return
(
SNode
*
)
pDst
;
}
static
SNode
*
logicVnodeModifCopy
(
const
SVnodeModifLogicNode
*
pSrc
,
SVnodeModifLogicNode
*
pDst
)
{
COPY_BASE_OBJECT_FIELD
(
node
,
logicNodeCopy
);
pDst
->
pDataBlocks
=
NULL
;
pDst
->
pVgDataBlocks
=
NULL
;
COPY_SCALAR_FIELD
(
msgType
);
return
(
SNode
*
)
pDst
;
}
static
SNode
*
logicExchangeCopy
(
const
SExchangeLogicNode
*
pSrc
,
SExchangeLogicNode
*
pDst
)
{
COPY_BASE_OBJECT_FIELD
(
node
,
logicNodeCopy
);
COPY_SCALAR_FIELD
(
srcGroupId
);
COPY_SCALAR_FIELD
(
precision
);
return
(
SNode
*
)
pDst
;
}
static
SNode
*
logicWindowCopy
(
const
SWindowLogicNode
*
pSrc
,
SWindowLogicNode
*
pDst
)
{
COPY_BASE_OBJECT_FIELD
(
node
,
logicNodeCopy
);
COPY_SCALAR_FIELD
(
winType
);
CLONE_NODE_LIST_FIELD
(
pFuncs
);
COPY_SCALAR_FIELD
(
interval
);
COPY_SCALAR_FIELD
(
offset
);
COPY_SCALAR_FIELD
(
sliding
);
COPY_SCALAR_FIELD
(
intervalUnit
);
COPY_SCALAR_FIELD
(
slidingUnit
);
COPY_SCALAR_FIELD
(
sessionGap
);
CLONE_NODE_FIELD
(
pTspk
);
CLONE_NODE_FIELD
(
pStateExpr
);
COPY_SCALAR_FIELD
(
triggerType
);
COPY_SCALAR_FIELD
(
watermark
);
return
(
SNode
*
)
pDst
;
}
static
SNode
*
logicFillCopy
(
const
SFillLogicNode
*
pSrc
,
SFillLogicNode
*
pDst
)
{
COPY_BASE_OBJECT_FIELD
(
node
,
logicNodeCopy
);
COPY_SCALAR_FIELD
(
mode
);
CLONE_NODE_FIELD
(
pWStartTs
);
CLONE_NODE_FIELD
(
pValues
);
COPY_OBJECT_FIELD
(
timeRange
,
sizeof
(
STimeWindow
));
return
(
SNode
*
)
pDst
;
}
...
...
@@ -301,28 +405,41 @@ static SNode* logicPartitionCopy(const SPartitionLogicNode* pSrc, SPartitionLogi
}
static
SNode
*
logicSubplanCopy
(
const
SLogicSubplan
*
pSrc
,
SLogicSubplan
*
pDst
)
{
COPY_OBJECT_FIELD
(
id
,
sizeof
(
SSubplanId
));
CLONE_NODE_FIELD
(
pNode
);
pDst
->
pChildren
=
NULL
;
pDst
->
pParents
=
NULL
;
pDst
->
pVgroupList
=
NULL
;
COPY_SCALAR_FIELD
(
subplanType
)
;
COPY_SCALAR_FIELD
(
level
)
;
COPY_SCALAR_FIELD
(
splitFlag
)
;
return
(
SNode
*
)
pDst
;
}
static
SNode
*
dataBlockDescCopy
(
const
SDataBlockDescNode
*
pSrc
,
SDataBlockDescNode
*
pDst
)
{
COPY_SCALAR_FIELD
(
dataBlockId
);
CLONE_NODE_LIST_FIELD
(
pSlots
);
COPY_SCALAR_FIELD
(
totalRowSize
);
COPY_SCALAR_FIELD
(
outputRowSize
);
COPY_SCALAR_FIELD
(
precision
);
return
(
SNode
*
)
pDst
;
}
static
SNode
*
slotDescCopy
(
const
SSlotDescNode
*
pSrc
,
SSlotDescNode
*
pDst
)
{
dataTypeCopy
(
&
pSrc
->
dataType
,
&
pDst
->
dataType
);
COPY_SCALAR_FIELD
(
slotId
);
COPY_OBJECT_FIELD
(
dataType
,
sizeof
(
SDataType
));
COPY_SCALAR_FIELD
(
reserve
);
COPY_SCALAR_FIELD
(
output
);
COPY_SCALAR_FIELD
(
tag
);
return
(
SNode
*
)
pDst
;
}
static
SNode
*
downstreamSourceCopy
(
const
SDownstreamSourceNode
*
pSrc
,
SDownstreamSourceNode
*
pDst
)
{
COPY_OBJECT_FIELD
(
addr
,
sizeof
(
SQueryNodeAddr
));
COPY_SCALAR_FIELD
(
taskId
);
COPY_SCALAR_FIELD
(
schedId
);
return
(
SNode
*
)
pDst
;
}
static
SNode
*
selectStmtCopy
(
const
SSelectStmt
*
pSrc
,
SSelectStmt
*
pDst
)
{
COPY_SCALAR_FIELD
(
isDistinct
);
CLONE_NODE_LIST_FIELD
(
pProjectionList
);
CLONE_NODE_FIELD
(
pFromTable
);
CLONE_NODE_FIELD
(
pWhere
);
...
...
@@ -333,6 +450,12 @@ static SNode* selectStmtCopy(const SSelectStmt* pSrc, SSelectStmt* pDst) {
CLONE_NODE_LIST_FIELD
(
pOrderByList
);
CLONE_NODE_FIELD
(
pLimit
);
CLONE_NODE_FIELD
(
pLimit
);
COPY_CHAR_ARRAY_FIELD
(
stmtName
);
COPY_SCALAR_FIELD
(
precision
);
COPY_SCALAR_FIELD
(
isEmptyResult
);
COPY_SCALAR_FIELD
(
isTimeOrderQuery
);
COPY_SCALAR_FIELD
(
hasAggFuncs
);
COPY_SCALAR_FIELD
(
hasRepeatScanFuncs
);
return
(
SNode
*
)
pDst
;
}
...
...
@@ -345,7 +468,6 @@ SNodeptr nodesCloneNode(const SNodeptr pNode) {
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
}
memcpy
(
pDst
,
pNode
,
nodesNodeSize
(
nodeType
(
pNode
)));
switch
(
nodeType
(
pNode
))
{
case
QUERY_NODE_COLUMN
:
return
columnNodeCopy
((
const
SColumnNode
*
)
pNode
,
(
SColumnNode
*
)
pDst
);
...
...
@@ -387,6 +509,8 @@ SNodeptr nodesCloneNode(const SNodeptr pNode) {
return
slotDescCopy
((
const
SSlotDescNode
*
)
pNode
,
(
SSlotDescNode
*
)
pDst
);
case
QUERY_NODE_DOWNSTREAM_SOURCE
:
return
downstreamSourceCopy
((
const
SDownstreamSourceNode
*
)
pNode
,
(
SDownstreamSourceNode
*
)
pDst
);
case
QUERY_NODE_LEFT_VALUE
:
return
pDst
;
case
QUERY_NODE_SELECT_STMT
:
return
selectStmtCopy
((
const
SSelectStmt
*
)
pNode
,
(
SSelectStmt
*
)
pDst
);
case
QUERY_NODE_LOGIC_PLAN_SCAN
:
...
...
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
83efe34b
...
...
@@ -78,6 +78,8 @@ const char* nodesNodeName(ENodeType type) {
return
"TableOptions"
;
case
QUERY_NODE_INDEX_OPTIONS
:
return
"IndexOptions"
;
case
QUERY_NODE_LEFT_VALUE
:
return
"LeftValue"
;
case
QUERY_NODE_SET_OPERATOR
:
return
"SetOperator"
;
case
QUERY_NODE_SELECT_STMT
:
...
...
@@ -3012,6 +3014,8 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
break
;
case
QUERY_NODE_DOWNSTREAM_SOURCE
:
return
downstreamSourceNodeToJson
(
pObj
,
pJson
);
case
QUERY_NODE_LEFT_VALUE
:
return
TSDB_CODE_SUCCESS
;
// SLeftValueNode has no fields to serialize.
case
QUERY_NODE_SET_OPERATOR
:
return
setOperatorToJson
(
pObj
,
pJson
);
case
QUERY_NODE_SELECT_STMT
:
...
...
@@ -3123,6 +3127,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
return
jsonToSlotDescNode
(
pJson
,
pObj
);
case
QUERY_NODE_DOWNSTREAM_SOURCE
:
return
jsonToDownstreamSourceNode
(
pJson
,
pObj
);
case
QUERY_NODE_LEFT_VALUE
:
return
TSDB_CODE_SUCCESS
;
// SLeftValueNode has no fields to deserialize.
case
QUERY_NODE_SET_OPERATOR
:
return
jsonToSetOperator
(
pJson
,
pObj
);
case
QUERY_NODE_SELECT_STMT
:
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
83efe34b
...
...
@@ -79,6 +79,8 @@ int32_t nodesNodeSize(ENodeType type) {
return
sizeof
(
SStreamOptions
);
case
QUERY_NODE_TOPIC_OPTIONS
:
return
sizeof
(
STopicOptions
);
case
QUERY_NODE_LEFT_VALUE
:
return
sizeof
(
SLeftValueNode
);
case
QUERY_NODE_SET_OPERATOR
:
return
sizeof
(
SSetOperator
);
case
QUERY_NODE_SELECT_STMT
:
...
...
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
83efe34b
...
...
@@ -599,14 +599,17 @@ typedef struct SRewritePrecalcExprsCxt {
static
EDealRes
collectAndRewrite
(
SRewritePrecalcExprsCxt
*
pCxt
,
SNode
**
pNode
)
{
SNode
*
pExpr
=
nodesCloneNode
(
*
pNode
);
if
(
NULL
==
pExpr
)
{
pCxt
->
errCode
=
TSDB_CODE_OUT_OF_MEMORY
;
return
DEAL_RES_ERROR
;
}
if
(
nodesListAppend
(
pCxt
->
pPrecalcExprs
,
pExpr
))
{
pCxt
->
errCode
=
TSDB_CODE_OUT_OF_MEMORY
;
nodesDestroyNode
(
pExpr
);
return
DEAL_RES_ERROR
;
}
SColumnNode
*
pCol
=
(
SColumnNode
*
)
nodesMakeNode
(
QUERY_NODE_COLUMN
);
if
(
NULL
==
pCol
)
{
pCxt
->
errCode
=
TSDB_CODE_OUT_OF_MEMORY
;
nodesDestroyNode
(
pExpr
);
return
DEAL_RES_ERROR
;
}
...
...
@@ -629,11 +632,16 @@ static int32_t rewriteValueToOperator(SRewritePrecalcExprsCxt* pCxt, SNode** pNo
if
(
NULL
==
pOper
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pOper
->
pLeft
=
nodesMakeNode
(
QUERY_NODE_LEFT_VALUE
);
if
(
NULL
==
pOper
->
pLeft
)
{
nodesDestroyNode
(
pOper
);
return
TSDB_CODE_OUT_OF_MEMORY
;
}
SValueNode
*
pVal
=
(
SValueNode
*
)
*
pNode
;
pOper
->
node
.
resType
=
pVal
->
node
.
resType
;
strcpy
(
pOper
->
node
.
aliasName
,
pVal
->
node
.
aliasName
);
pOper
->
opType
=
OP_TYPE_ASSIGN
;
pOper
->
p
Lef
t
=
*
pNode
;
pOper
->
p
Righ
t
=
*
pNode
;
*
pNode
=
(
SNode
*
)
pOper
;
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -642,7 +650,8 @@ static EDealRes doRewritePrecalcExprs(SNode** pNode, void* pContext) {
SRewritePrecalcExprsCxt
*
pCxt
=
(
SRewritePrecalcExprsCxt
*
)
pContext
;
switch
(
nodeType
(
*
pNode
))
{
case
QUERY_NODE_VALUE
:
{
if
(
TSDB_CODE_SUCCESS
!=
rewriteValueToOperator
(
pCxt
,
pNode
))
{
pCxt
->
errCode
=
rewriteValueToOperator
(
pCxt
,
pNode
);
if
(
TSDB_CODE_SUCCESS
!=
pCxt
->
errCode
)
{
return
DEAL_RES_ERROR
;
}
return
collectAndRewrite
(
pCxt
,
pNode
);
...
...
@@ -697,9 +706,8 @@ static int32_t rewritePrecalcExprs(SPhysiPlanContext* pCxt, SNodeList* pList, SN
}
SRewritePrecalcExprsCxt
cxt
=
{.
errCode
=
TSDB_CODE_SUCCESS
,
.
pPrecalcExprs
=
*
pPrecalcExprs
};
nodesRewriteExprs
(
*
pRewrittenList
,
doRewritePrecalcExprs
,
&
cxt
);
if
(
0
==
LIST_LENGTH
(
cxt
.
pPrecalcExprs
))
{
nodesDestroyList
(
cxt
.
pPrecalcExprs
);
*
pPrecalcExprs
=
NULL
;
if
(
0
==
LIST_LENGTH
(
cxt
.
pPrecalcExprs
)
||
TSDB_CODE_SUCCESS
!=
cxt
.
errCode
)
{
DESTORY_LIST
(
*
pPrecalcExprs
);
}
return
cxt
.
errCode
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录