Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9f93b1eb
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
9f93b1eb
编写于
3月 29, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-14281 deal memory leak
上级
e7a54cfa
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
371 addition
and
38 deletion
+371
-38
include/libs/nodes/plannodes.h
include/libs/nodes/plannodes.h
+1
-1
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+3
-0
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+7
-0
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+334
-36
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+3
-0
source/libs/parser/src/parser.c
source/libs/parser/src/parser.c
+2
-0
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+14
-1
source/libs/planner/src/planScaleOut.c
source/libs/planner/src/planScaleOut.c
+2
-0
source/libs/planner/test/plannerTest.cpp
source/libs/planner/test/plannerTest.cpp
+5
-0
未找到文件。
include/libs/nodes/plannodes.h
浏览文件 @
9f93b1eb
...
...
@@ -197,7 +197,6 @@ typedef struct STableScanPhysiNode {
SScanPhysiNode
scan
;
uint8_t
scanFlag
;
// denotes reversed scan of data or not
STimeWindow
scanRange
;
SNode
*
pScanConditions
;
}
STableScanPhysiNode
;
typedef
STableScanPhysiNode
STableSeqScanPhysiNode
;
...
...
@@ -252,6 +251,7 @@ typedef struct SIntervalPhysiNode {
int64_t
sliding
;
int8_t
intervalUnit
;
int8_t
slidingUnit
;
uint8_t
precision
;
SFillNode
*
pFill
;
}
SIntervalPhysiNode
;
...
...
source/client/src/clientEnv.c
浏览文件 @
9f93b1eb
...
...
@@ -200,6 +200,9 @@ static void doDestroyRequest(void *p) {
taosArrayDestroy
(
pRequest
->
body
.
showInfo
.
pArray
);
}
taosArrayDestroy
(
pRequest
->
tableList
);
taosArrayDestroy
(
pRequest
->
dbList
);
deregisterRequest
(
pRequest
);
taosMemoryFreeClear
(
pRequest
);
}
...
...
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
9f93b1eb
...
...
@@ -1057,6 +1057,7 @@ static const char* jkIntervalPhysiPlanIntervalUnit = "intervalUnit";
static
const
char
*
jkIntervalPhysiPlanSlidingUnit
=
"slidingUnit"
;
static
const
char
*
jkIntervalPhysiPlanFill
=
"Fill"
;
static
const
char
*
jkIntervalPhysiPlanTsPk
=
"TsPk"
;
static
const
char
*
jkIntervalPhysiPlanPrecision
=
"Precision"
;
static
int32_t
physiIntervalNodeToJson
(
const
void
*
pObj
,
SJson
*
pJson
)
{
const
SIntervalPhysiNode
*
pNode
=
(
const
SIntervalPhysiNode
*
)
pObj
;
...
...
@@ -1083,6 +1084,9 @@ static int32_t physiIntervalNodeToJson(const void* pObj, SJson* pJson) {
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddObject
(
pJson
,
jkIntervalPhysiPlanTsPk
,
nodeToJson
,
pNode
->
pTspk
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddIntegerToObject
(
pJson
,
jkIntervalPhysiPlanPrecision
,
pNode
->
precision
);
}
return
code
;
}
...
...
@@ -1112,6 +1116,9 @@ static int32_t jsonToPhysiIntervalNode(const SJson* pJson, void* pObj) {
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkIntervalPhysiPlanTsPk
,
(
SNode
**
)
&
pNode
->
pTspk
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonGetUTinyIntValue
(
pJson
,
jkIntervalPhysiPlanPrecision
,
&
pNode
->
precision
);
}
return
code
;
}
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
9f93b1eb
...
...
@@ -204,49 +204,159 @@ SNodeptr nodesMakeNode(ENodeType type) {
return
NULL
;
}
static
EDealRes
destroyNode
(
SNode
**
pNode
,
void
*
pContext
)
{
switch
(
nodeType
(
*
pNode
))
{
static
void
destroyVgDataBlockArray
(
SArray
*
pArray
)
{
size_t
size
=
taosArrayGetSize
(
pArray
);
for
(
size_t
i
=
0
;
i
<
size
;
++
i
)
{
SVgDataBlocks
*
pVg
=
taosArrayGetP
(
pArray
,
i
);
taosMemoryFreeClear
(
pVg
->
pData
);
taosMemoryFreeClear
(
pVg
);
}
taosArrayDestroy
(
pArray
);
}
static
void
destroyLogicNode
(
SLogicNode
*
pNode
)
{
nodesDestroyList
(
pNode
->
pChildren
);
nodesDestroyNode
(
pNode
->
pConditions
);
nodesDestroyList
(
pNode
->
pTargets
);
}
static
void
destroyPhysiNode
(
SPhysiNode
*
pNode
)
{
nodesDestroyList
(
pNode
->
pChildren
);
nodesDestroyNode
(
pNode
->
pConditions
);
nodesDestroyNode
(
pNode
->
pOutputDataBlockDesc
);
}
static
void
destroyWinodwPhysiNode
(
SWinodwPhysiNode
*
pNode
)
{
destroyPhysiNode
((
SPhysiNode
*
)
pNode
);
nodesDestroyList
(
pNode
->
pExprs
);
nodesDestroyList
(
pNode
->
pFuncs
);
}
static
void
destroyScanPhysiNode
(
SScanPhysiNode
*
pNode
)
{
destroyPhysiNode
((
SPhysiNode
*
)
pNode
);
nodesDestroyList
(
pNode
->
pScanCols
);
}
static
void
destroyDataSinkNode
(
SDataSinkNode
*
pNode
)
{
nodesDestroyNode
(
pNode
->
pInputDataBlockDesc
);
}
void
nodesDestroyNode
(
SNodeptr
pNode
)
{
if
(
NULL
==
pNode
)
{
return
;
}
switch
(
nodeType
(
pNode
))
{
case
QUERY_NODE_COLUMN
:
// pProjectRef is weak reference, no need to release
break
;
case
QUERY_NODE_VALUE
:
{
SValueNode
*
pValue
=
(
SValueNode
*
)
*
pNode
;
SValueNode
*
pValue
=
(
SValueNode
*
)
pNode
;
taosMemoryFreeClear
(
pValue
->
literal
);
if
(
IS_VAR_DATA_TYPE
(
pValue
->
node
.
resType
.
type
))
{
taosMemoryFreeClear
(
pValue
->
datum
.
p
);
}
break
;
}
case
QUERY_NODE_OPERATOR
:
{
SOperatorNode
*
pOp
=
(
SOperatorNode
*
)
pNode
;
nodesDestroyNode
(
pOp
->
pLeft
);
nodesDestroyNode
(
pOp
->
pRight
);
break
;
}
case
QUERY_NODE_LOGIC_CONDITION
:
nodes
ClearList
(((
SLogicConditionNode
*
)(
*
pNode
)
)
->
pParameterList
);
nodes
DestroyList
(((
SLogicConditionNode
*
)
pNode
)
->
pParameterList
);
break
;
case
QUERY_NODE_FUNCTION
:
nodes
ClearList
(((
SFunctionNode
*
)(
*
pNode
)
)
->
pParameterList
);
nodes
DestroyList
(((
SFunctionNode
*
)
pNode
)
->
pParameterList
);
break
;
case
QUERY_NODE_REAL_TABLE
:
{
SRealTableNode
*
pReal
=
(
SRealTableNode
*
)
*
pNode
;
SRealTableNode
*
pReal
=
(
SRealTableNode
*
)
pNode
;
taosMemoryFreeClear
(
pReal
->
pMeta
);
taosMemoryFreeClear
(
pReal
->
pVgroupList
);
break
;
}
case
QUERY_NODE_TEMP_TABLE
:
nodesDestroyNode
(((
STempTableNode
*
)(
*
pNode
))
->
pSubquery
);
nodesDestroyNode
(((
STempTableNode
*
)
pNode
)
->
pSubquery
);
break
;
case
QUERY_NODE_JOIN_TABLE
:
{
SJoinTableNode
*
pJoin
=
(
SJoinTableNode
*
)
pNode
;
nodesDestroyNode
(
pJoin
->
pLeft
);
nodesDestroyNode
(
pJoin
->
pRight
);
nodesDestroyNode
(
pJoin
->
pOnCond
);
break
;
}
case
QUERY_NODE_GROUPING_SET
:
nodesClearList
(((
SGroupingSetNode
*
)(
*
pNode
))
->
pParameterList
);
nodesDestroyList
(((
SGroupingSetNode
*
)
pNode
)
->
pParameterList
);
break
;
case
QUERY_NODE_ORDER_BY_EXPR
:
nodesDestroyNode
(((
SOrderByExprNode
*
)
pNode
)
->
pExpr
);
break
;
case
QUERY_NODE_LIMIT
:
// no pointer field
break
;
case
QUERY_NODE_STATE_WINDOW
:
nodesDestroyNode
(((
SStateWindowNode
*
)
pNode
)
->
pCol
);
break
;
case
QUERY_NODE_SESSION_WINDOW
:
{
SSessionWindowNode
*
pSession
=
(
SSessionWindowNode
*
)
pNode
;
nodesDestroyNode
(
pSession
->
pCol
);
nodesDestroyNode
(
pSession
->
pGap
);
break
;
}
case
QUERY_NODE_INTERVAL_WINDOW
:
{
SIntervalWindowNode
*
pJoin
=
(
SIntervalWindowNode
*
)
pNode
;
nodesDestroyNode
(
pJoin
->
pCol
);
nodesDestroyNode
(
pJoin
->
pInterval
);
nodesDestroyNode
(
pJoin
->
pOffset
);
nodesDestroyNode
(
pJoin
->
pSliding
);
nodesDestroyNode
(
pJoin
->
pFill
);
break
;
}
case
QUERY_NODE_NODE_LIST
:
nodesClearList
(((
SNodeListNode
*
)(
*
pNode
))
->
pNodeList
);
nodesDestroyList
(((
SNodeListNode
*
)
pNode
)
->
pNodeList
);
break
;
case
QUERY_NODE_FILL
:
nodesDestroyNode
(((
SFillNode
*
)
pNode
)
->
pValues
);
break
;
case
QUERY_NODE_RAW_EXPR
:
nodesDestroyNode
(((
SRawExprNode
*
)
pNode
)
->
pNode
);
break
;
case
QUERY_NODE_TARGET
:
nodesDestroyNode
(((
STargetNode
*
)
pNode
)
->
pExpr
);
break
;
case
QUERY_NODE_DATABLOCK_DESC
:
nodesDestroyList
(((
SDataBlockDescNode
*
)
pNode
)
->
pSlots
);
break
;
case
QUERY_NODE_SLOT_DESC
:
// no pointer field
case
QUERY_NODE_COLUMN_DEF
:
// no pointer field
case
QUERY_NODE_DOWNSTREAM_SOURCE
:
// no pointer field
break
;
case
QUERY_NODE_DATABASE_OPTIONS
:
nodesDestroyList
(((
SDatabaseOptions
*
)
pNode
)
->
pRetentions
);
break
;
case
QUERY_NODE_TABLE_OPTIONS
:
{
STableOptions
*
pStmt
=
(
STableOptions
*
)
pNode
;
nodesDestroyList
(
pStmt
->
pSma
);
nodesDestroyList
(
pStmt
->
pFuncs
);
break
;
}
case
QUERY_NODE_INDEX_OPTIONS
:
{
SIndexOptions
*
pStmt
=
(
SIndexOptions
*
)
*
pNode
;
SIndexOptions
*
pStmt
=
(
SIndexOptions
*
)
pNode
;
nodesDestroyList
(
pStmt
->
pFuncs
);
nodesDestroyNode
(
pStmt
->
pInterval
);
nodesDestroyNode
(
pStmt
->
pOffset
);
nodesDestroyNode
(
pStmt
->
pSliding
);
break
;
}
case
QUERY_NODE_SET_OPERATOR
:
{
SSetOperator
*
pStmt
=
(
SSetOperator
*
)
pNode
;
nodesDestroyNode
(
pStmt
->
pLeft
);
nodesDestroyNode
(
pStmt
->
pRight
);
nodesDestroyList
(
pStmt
->
pOrderByList
);
nodesDestroyNode
(
pStmt
->
pLimit
);
break
;
}
case
QUERY_NODE_SELECT_STMT
:
{
SSelectStmt
*
pStmt
=
(
SSelectStmt
*
)
*
pNode
;
SSelectStmt
*
pStmt
=
(
SSelectStmt
*
)
pNode
;
nodesDestroyList
(
pStmt
->
pProjectionList
);
nodesDestroyNode
(
pStmt
->
pFromTable
);
nodesDestroyNode
(
pStmt
->
pWhere
);
...
...
@@ -259,50 +369,238 @@ static EDealRes destroyNode(SNode** pNode, void* pContext) {
nodesDestroyNode
(
pStmt
->
pSlimit
);
break
;
}
case
QUERY_NODE_VNODE_MODIF_STMT
:
{
SVnodeModifOpStmt
*
pStmt
=
(
SVnodeModifOpStmt
*
)
*
pNode
;
size_t
size
=
taosArrayGetSize
(
pStmt
->
pDataBlocks
);
for
(
size_t
i
=
0
;
i
<
size
;
++
i
)
{
SVgDataBlocks
*
pVg
=
taosArrayGetP
(
pStmt
->
pDataBlocks
,
i
);
taosMemoryFreeClear
(
pVg
->
pData
);
taosMemoryFreeClear
(
pVg
);
}
taosArrayDestroy
(
pStmt
->
pDataBlocks
);
case
QUERY_NODE_VNODE_MODIF_STMT
:
destroyVgDataBlockArray
(((
SVnodeModifOpStmt
*
)
pNode
)
->
pDataBlocks
);
break
;
case
QUERY_NODE_CREATE_DATABASE_STMT
:
nodesDestroyNode
(((
SCreateDatabaseStmt
*
)
pNode
)
->
pOptions
);
break
;
case
QUERY_NODE_DROP_DATABASE_STMT
:
// no pointer field
break
;
case
QUERY_NODE_ALTER_DATABASE_STMT
:
nodesDestroyNode
(((
SAlterDatabaseStmt
*
)
pNode
)
->
pOptions
);
break
;
}
case
QUERY_NODE_CREATE_TABLE_STMT
:
{
SCreateTableStmt
*
pStmt
=
(
SCreateTableStmt
*
)
*
pNode
;
SCreateTableStmt
*
pStmt
=
(
SCreateTableStmt
*
)
pNode
;
nodesDestroyList
(
pStmt
->
pCols
);
nodesDestroyList
(
pStmt
->
pTags
);
nodesDestroyNode
(
pStmt
->
pOptions
);
break
;
}
case
QUERY_NODE_CREATE_SUBTABLE_CLAUSE
:
{
SCreateSubTableClause
*
pStmt
=
(
SCreateSubTableClause
*
)
*
pNode
;
SCreateSubTableClause
*
pStmt
=
(
SCreateSubTableClause
*
)
pNode
;
nodesDestroyList
(
pStmt
->
pSpecificTags
);
nodesDestroyList
(
pStmt
->
pValsOfTags
);
break
;
}
case
QUERY_NODE_CREATE_MULTI_TABLE_STMT
:
nodesDestroyList
(((
SCreateMultiTableStmt
*
)(
*
pNode
))
->
pSubTables
);
nodesDestroyList
(((
SCreateMultiTableStmt
*
)
pNode
)
->
pSubTables
);
break
;
case
QUERY_NODE_DROP_TABLE_CLAUSE
:
// no pointer field
break
;
case
QUERY_NODE_DROP_TABLE_STMT
:
nodesDestroyNode
(((
SDropTableStmt
*
)
pNode
)
->
pTables
);
break
;
case
QUERY_NODE_DROP_SUPER_TABLE_STMT
:
// no pointer field
break
;
case
QUERY_NODE_ALTER_TABLE_STMT
:
{
SAlterTableStmt
*
pStmt
=
(
SAlterTableStmt
*
)
pNode
;
nodesDestroyNode
(
pStmt
->
pOptions
);
nodesDestroyNode
(
pStmt
->
pVal
);
break
;
}
case
QUERY_NODE_CREATE_USER_STMT
:
// no pointer field
case
QUERY_NODE_ALTER_USER_STMT
:
// no pointer field
case
QUERY_NODE_DROP_USER_STMT
:
// no pointer field
case
QUERY_NODE_USE_DATABASE_STMT
:
// no pointer field
case
QUERY_NODE_CREATE_DNODE_STMT
:
// no pointer field
case
QUERY_NODE_DROP_DNODE_STMT
:
// no pointer field
case
QUERY_NODE_ALTER_DNODE_STMT
:
// no pointer field
break
;
case
QUERY_NODE_CREATE_INDEX_STMT
:
{
SCreateIndexStmt
*
pStmt
=
(
SCreateIndexStmt
*
)
*
pNode
;
SCreateIndexStmt
*
pStmt
=
(
SCreateIndexStmt
*
)
pNode
;
nodesDestroyNode
(
pStmt
->
pOptions
);
nodesDestroyList
(
pStmt
->
pCols
);
break
;
}
case
QUERY_NODE_DROP_INDEX_STMT
:
// no pointer field
case
QUERY_NODE_CREATE_QNODE_STMT
:
// no pointer field
case
QUERY_NODE_DROP_QNODE_STMT
:
// no pointer field
break
;
case
QUERY_NODE_CREATE_TOPIC_STMT
:
nodesDestroyNode
(((
SCreateTopicStmt
*
)
pNode
)
->
pQuery
);
break
;
case
QUERY_NODE_DROP_TOPIC_STMT
:
// no pointer field
case
QUERY_NODE_ALTER_LOCAL_STMT
:
// no pointer field
break
;
case
QUERY_NODE_SHOW_DATABASES_STMT
:
case
QUERY_NODE_SHOW_TABLES_STMT
:
case
QUERY_NODE_SHOW_STABLES_STMT
:
case
QUERY_NODE_SHOW_USERS_STMT
:
case
QUERY_NODE_SHOW_DNODES_STMT
:
case
QUERY_NODE_SHOW_VGROUPS_STMT
:
case
QUERY_NODE_SHOW_MNODES_STMT
:
case
QUERY_NODE_SHOW_MODULES_STMT
:
case
QUERY_NODE_SHOW_QNODES_STMT
:
case
QUERY_NODE_SHOW_FUNCTIONS_STMT
:
case
QUERY_NODE_SHOW_INDEXES_STMT
:
case
QUERY_NODE_SHOW_STREAMS_STMT
:
{
SShowStmt
*
pStmt
=
(
SShowStmt
*
)
pNode
;
nodesDestroyNode
(
pStmt
->
pDbName
);
nodesDestroyNode
(
pStmt
->
pTbNamePattern
);
break
;
}
case
QUERY_NODE_LOGIC_PLAN_SCAN
:
{
SScanLogicNode
*
pLogicNode
=
(
SScanLogicNode
*
)
pNode
;
destroyLogicNode
((
SLogicNode
*
)
pLogicNode
);
nodesDestroyList
(
pLogicNode
->
pScanCols
);
taosMemoryFreeClear
(
pLogicNode
->
pMeta
);
taosMemoryFreeClear
(
pLogicNode
->
pVgroupList
);
break
;
}
case
QUERY_NODE_LOGIC_PLAN_JOIN
:
{
SJoinLogicNode
*
pLogicNode
=
(
SJoinLogicNode
*
)
pNode
;
destroyLogicNode
((
SLogicNode
*
)
pLogicNode
);
nodesDestroyNode
(
pLogicNode
->
pOnConditions
);
break
;
}
case
QUERY_NODE_LOGIC_PLAN_AGG
:
{
SAggLogicNode
*
pLogicNode
=
(
SAggLogicNode
*
)
pNode
;
destroyLogicNode
((
SLogicNode
*
)
pLogicNode
);
nodesDestroyList
(
pLogicNode
->
pAggFuncs
);
nodesDestroyList
(
pLogicNode
->
pGroupKeys
);
break
;
}
case
QUERY_NODE_LOGIC_PLAN_PROJECT
:
{
SProjectLogicNode
*
pLogicNode
=
(
SProjectLogicNode
*
)
pNode
;
destroyLogicNode
((
SLogicNode
*
)
pLogicNode
);
nodesDestroyList
(
pLogicNode
->
pProjections
);
break
;
}
case
QUERY_NODE_LOGIC_PLAN_VNODE_MODIF
:
{
SVnodeModifLogicNode
*
pLogicNode
=
(
SVnodeModifLogicNode
*
)
pNode
;
destroyLogicNode
((
SLogicNode
*
)
pLogicNode
);
destroyVgDataBlockArray
(
pLogicNode
->
pDataBlocks
);
taosMemoryFreeClear
(
pLogicNode
->
pVgDataBlocks
->
pData
);
taosMemoryFreeClear
(
pLogicNode
->
pVgDataBlocks
);
break
;
}
case
QUERY_NODE_LOGIC_PLAN_EXCHANGE
:
destroyLogicNode
((
SLogicNode
*
)
pNode
);
break
;
case
QUERY_NODE_LOGIC_PLAN_WINDOW
:
{
SWindowLogicNode
*
pLogicNode
=
(
SWindowLogicNode
*
)
pNode
;
destroyLogicNode
((
SLogicNode
*
)
pLogicNode
);
nodesDestroyList
(
pLogicNode
->
pFuncs
);
nodesDestroyNode
(
pLogicNode
->
pFill
);
nodesDestroyNode
(
pLogicNode
->
pTspk
);
break
;
}
case
QUERY_NODE_LOGIC_PLAN_SORT
:
{
SSortLogicNode
*
pLogicNode
=
(
SSortLogicNode
*
)
pNode
;
destroyLogicNode
((
SLogicNode
*
)
pLogicNode
);
nodesDestroyList
(
pLogicNode
->
pSortKeys
);
break
;
}
case
QUERY_NODE_LOGIC_PLAN_PARTITION
:
{
SPartitionLogicNode
*
pLogicNode
=
(
SPartitionLogicNode
*
)
pNode
;
destroyLogicNode
((
SLogicNode
*
)
pLogicNode
);
nodesDestroyList
(
pLogicNode
->
pPartitionKeys
);
break
;
}
case
QUERY_NODE_LOGIC_SUBPLAN
:
{
SLogicSubplan
*
pSubplan
=
(
SLogicSubplan
*
)
pNode
;
nodesDestroyList
(
pSubplan
->
pChildren
);
nodesDestroyNode
(
pSubplan
->
pNode
);
taosMemoryFreeClear
(
pSubplan
->
pVgroupList
);
break
;
}
case
QUERY_NODE_LOGIC_PLAN
:
nodesDestroyList
(((
SQueryLogicPlan
*
)
pNode
)
->
pTopSubplans
);
break
;
case
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN
:
destroyScanPhysiNode
((
SScanPhysiNode
*
)
pNode
);
break
;
case
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
:
destroyScanPhysiNode
((
SScanPhysiNode
*
)
pNode
);
break
;
case
QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN
:
destroyScanPhysiNode
((
SScanPhysiNode
*
)
pNode
);
break
;
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
:
destroyScanPhysiNode
((
SScanPhysiNode
*
)
pNode
);
break
;
case
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN
:
destroyScanPhysiNode
((
SScanPhysiNode
*
)
pNode
);
break
;
case
QUERY_NODE_PHYSICAL_PLAN_PROJECT
:
{
SProjectPhysiNode
*
pPhyNode
=
(
SProjectPhysiNode
*
)
pNode
;
destroyPhysiNode
((
SPhysiNode
*
)
pPhyNode
);
nodesDestroyList
(
pPhyNode
->
pProjections
);
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_JOIN
:
{
SJoinPhysiNode
*
pPhyNode
=
(
SJoinPhysiNode
*
)
pNode
;
destroyPhysiNode
((
SPhysiNode
*
)
pPhyNode
);
nodesDestroyNode
(
pPhyNode
->
pOnConditions
);
nodesDestroyList
(
pPhyNode
->
pTargets
);
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_AGG
:
{
SAggPhysiNode
*
pPhyNode
=
(
SAggPhysiNode
*
)
pNode
;
destroyPhysiNode
((
SPhysiNode
*
)
pPhyNode
);
nodesDestroyList
(
pPhyNode
->
pExprs
);
nodesDestroyList
(
pPhyNode
->
pAggFuncs
);
nodesDestroyList
(
pPhyNode
->
pGroupKeys
);
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_EXCHANGE
:
{
SExchangePhysiNode
*
pPhyNode
=
(
SExchangePhysiNode
*
)
pNode
;
destroyPhysiNode
((
SPhysiNode
*
)
pPhyNode
);
nodesDestroyList
(
pPhyNode
->
pSrcEndPoints
);
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_SORT
:
{
SSortPhysiNode
*
pPhyNode
=
(
SSortPhysiNode
*
)
pNode
;
destroyPhysiNode
((
SPhysiNode
*
)
pPhyNode
);
nodesDestroyNode
(
pPhyNode
->
pExprs
);
nodesDestroyNode
(
pPhyNode
->
pSortKeys
);
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_INTERVAL
:
{
SIntervalPhysiNode
*
pPhyNode
=
(
SIntervalPhysiNode
*
)
pNode
;
destroyWinodwPhysiNode
((
SWinodwPhysiNode
*
)
pPhyNode
);
nodesDestroyNode
(
pPhyNode
->
pFill
);
nodesDestroyNode
(
pPhyNode
->
pTspk
);
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW
:
destroyWinodwPhysiNode
((
SWinodwPhysiNode
*
)
pNode
);
break
;
case
QUERY_NODE_PHYSICAL_PLAN_DISPATCH
:
destroyDataSinkNode
((
SDataSinkNode
*
)
pNode
);
break
;
case
QUERY_NODE_PHYSICAL_PLAN_INSERT
:
{
SDataInserterNode
*
pSink
=
(
SDataInserterNode
*
)
pNode
;
destroyDataSinkNode
((
SDataSinkNode
*
)
pSink
);
taosMemoryFreeClear
(
pSink
->
pData
);
break
;
}
case
QUERY_NODE_PHYSICAL_SUBPLAN
:
{
SSubplan
*
pSubplan
=
(
SSubplan
*
)
pNode
;
nodesDestroyList
(
pSubplan
->
pChildren
);
nodesDestroyNode
(
pSubplan
->
pNode
);
nodesDestroyNode
(
pSubplan
->
pDataSink
);
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN
:
nodesDestroyList
(((
SQueryPlan
*
)
pNode
)
->
pSubplans
);
break
;
default:
break
;
}
taosMemoryFreeClear
(
*
pNode
);
return
DEAL_RES_CONTINUE
;
}
void
nodesDestroyNode
(
SNodeptr
pNode
)
{
if
(
NULL
==
pNode
)
{
return
;
}
nodesRewriteNodePostOrder
((
SNode
**
)
&
pNode
,
destroyNode
,
NULL
);
taosMemoryFreeClear
(
pNode
);
return
;
}
SNodeList
*
nodesMakeList
()
{
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
9f93b1eb
...
...
@@ -228,6 +228,9 @@ static void setColumnInfoBySchema(const SRealTableNode* pTable, const SSchema* p
pCol
->
colType
=
isTag
?
COLUMN_TYPE_TAG
:
COLUMN_TYPE_COLUMN
;
pCol
->
node
.
resType
.
type
=
pColSchema
->
type
;
pCol
->
node
.
resType
.
bytes
=
pColSchema
->
bytes
;
if
(
TSDB_DATA_TYPE_TIMESTAMP
==
pCol
->
node
.
resType
.
type
)
{
pCol
->
node
.
resType
.
precision
=
pTable
->
pMeta
->
tableInfo
.
precision
;
}
}
static
void
setColumnInfoByExpr
(
const
STableNode
*
pTable
,
SExprNode
*
pExpr
,
SColumnNode
*
pCol
)
{
...
...
source/libs/parser/src/parser.c
浏览文件 @
9f93b1eb
...
...
@@ -58,5 +58,7 @@ void qDestroyQuery(SQuery* pQueryNode) {
taosMemoryFreeClear
(
pQueryNode
->
pCmdMsg
->
pMsg
);
taosMemoryFreeClear
(
pQueryNode
->
pCmdMsg
);
}
taosArrayDestroy
(
pQueryNode
->
pDbList
);
taosArrayDestroy
(
pQueryNode
->
pTableList
);
taosMemoryFreeClear
(
pQueryNode
);
}
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
9f93b1eb
...
...
@@ -780,6 +780,7 @@ static int32_t createIntervalPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChil
pInterval
->
sliding
=
pWindowLogicNode
->
sliding
;
pInterval
->
intervalUnit
=
pWindowLogicNode
->
intervalUnit
;
pInterval
->
slidingUnit
=
pWindowLogicNode
->
slidingUnit
;
pInterval
->
precision
=
((
SColumnNode
*
)
pWindowLogicNode
->
pTspk
)
->
node
.
resType
.
precision
;
pInterval
->
pFill
=
nodesCloneNode
(
pWindowLogicNode
->
pFill
);
if
(
NULL
!=
pWindowLogicNode
->
pFill
&&
NULL
==
pInterval
->
pFill
)
{
...
...
@@ -1080,6 +1081,16 @@ static int32_t doCreatePhysiPlan(SPhysiPlanContext* pCxt, SQueryLogicPlan* pLogi
return
code
;
}
static
void
destoryLocationHash
(
void
*
p
)
{
SHashObj
*
pHash
=
*
(
SHashObj
**
)
p
;
// todo
taosHashCleanup
(
pHash
);
}
static
void
destoryPhysiPlanContext
(
SPhysiPlanContext
*
pCxt
)
{
taosArrayDestroyEx
(
pCxt
->
pLocationHelper
,
destoryLocationHash
);
}
int32_t
createPhysiPlan
(
SPlanContext
*
pCxt
,
SQueryLogicPlan
*
pLogicPlan
,
SQueryPlan
**
pPlan
,
SArray
*
pExecNodeList
)
{
SPhysiPlanContext
cxt
=
{
.
pPlanCxt
=
pCxt
,
...
...
@@ -1091,5 +1102,7 @@ int32_t createPhysiPlan(SPlanContext* pCxt, SQueryLogicPlan* pLogicPlan, SQueryP
if
(
NULL
==
cxt
.
pLocationHelper
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
return
doCreatePhysiPlan
(
&
cxt
,
pLogicPlan
,
pPlan
);
int32_t
code
=
doCreatePhysiPlan
(
&
cxt
,
pLogicPlan
,
pPlan
);
destoryPhysiPlanContext
(
&
cxt
);
return
code
;
}
source/libs/planner/src/planScaleOut.c
浏览文件 @
9f93b1eb
...
...
@@ -167,6 +167,8 @@ static int32_t doScaleOut(SScaleOutContext* pCxt, SLogicSubplan* pSubplan, int32
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
nodesDestroyList
(
pCurrentGroup
);
}
else
{
nodesClearList
(
pCurrentGroup
);
}
return
code
;
...
...
source/libs/planner/test/plannerTest.cpp
浏览文件 @
9f93b1eb
...
...
@@ -248,6 +248,11 @@ TEST_F(PlannerTest, showTables) {
bind
(
"show tables"
);
ASSERT_TRUE
(
run
());
setDatabase
(
"root"
,
"information_schema"
);
bind
(
"show tables"
);
ASSERT_TRUE
(
run
());
}
TEST_F
(
PlannerTest
,
showStables
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录