Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f9da4abd
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看板
提交
f9da4abd
编写于
5月 19, 2023
作者:
S
slzhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: change more variable names
上级
f36b0be1
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
33 addition
and
33 deletion
+33
-33
include/libs/nodes/plannodes.h
include/libs/nodes/plannodes.h
+2
-2
source/libs/executor/src/joinoperator.c
source/libs/executor/src/joinoperator.c
+11
-11
source/libs/nodes/src/nodesCloneFuncs.c
source/libs/nodes/src/nodesCloneFuncs.c
+1
-1
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+6
-6
source/libs/nodes/src/nodesMsgFuncs.c
source/libs/nodes/src/nodesMsgFuncs.c
+2
-2
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+2
-2
source/libs/planner/src/planOptimizer.c
source/libs/planner/src/planOptimizer.c
+7
-7
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+2
-2
未找到文件。
include/libs/nodes/plannodes.h
浏览文件 @
f9da4abd
...
...
@@ -112,7 +112,7 @@ typedef struct SJoinLogicNode {
SNode
*
pOnConditions
;
bool
isSingleTableJoin
;
EOrder
inputTsOrder
;
SNode
*
pEqualOnConditions
;
SNode
*
p
Col
EqualOnConditions
;
}
SJoinLogicNode
;
typedef
struct
SAggLogicNode
{
...
...
@@ -406,7 +406,7 @@ typedef struct SSortMergeJoinPhysiNode {
SNode
*
pOnConditions
;
SNodeList
*
pTargets
;
EOrder
inputTsOrder
;
SNode
*
p
EqualOnCond
tions
;
SNode
*
p
ColEqualOnCondi
tions
;
}
SSortMergeJoinPhysiNode
;
typedef
struct
SAggPhysiNode
{
...
...
source/libs/executor/src/joinoperator.c
浏览文件 @
f9da4abd
...
...
@@ -52,7 +52,7 @@ typedef struct SJoinOperatorInfo {
int32_t
rightPos
;
SColumnInfo
rightCol
;
SNode
*
pCondAfterMerge
;
SNode
*
pEqualOnConditions
;
SNode
*
p
Col
EqualOnConditions
;
SArray
*
leftEqOnCondCols
;
char
*
leftEqOnCondKeyBuf
;
...
...
@@ -117,13 +117,13 @@ static void extractEqualOnCondColsFromOper(SJoinOperatorInfo* pInfo, SOperatorIn
}
}
static
void
extract
TagEqualCondCols
(
SJoinOperatorInfo
*
pInfo
,
SOperatorInfo
**
pDownStream
,
SNode
*
pTagEqual
Node
,
static
void
extract
EqualOnCondCols
(
SJoinOperatorInfo
*
pInfo
,
SOperatorInfo
**
pDownStream
,
SNode
*
pEqualOnCond
Node
,
SArray
*
leftTagEqCols
,
SArray
*
rightTagEqCols
)
{
SColumn
left
=
{
0
};
SColumn
right
=
{
0
};
if
(
nodeType
(
p
TagEqualNode
)
==
QUERY_NODE_LOGIC_CONDITION
&&
((
SLogicConditionNode
*
)
pTagEqual
Node
)
->
condType
==
LOGIC_COND_TYPE_AND
)
{
if
(
nodeType
(
p
EqualOnCondNode
)
==
QUERY_NODE_LOGIC_CONDITION
&&
((
SLogicConditionNode
*
)
pEqualOnCond
Node
)
->
condType
==
LOGIC_COND_TYPE_AND
)
{
SNode
*
pNode
=
NULL
;
FOREACH
(
pNode
,
((
SLogicConditionNode
*
)
p
TagEqual
Node
)
->
pParameterList
)
{
FOREACH
(
pNode
,
((
SLogicConditionNode
*
)
p
EqualOnCond
Node
)
->
pParameterList
)
{
SOperatorNode
*
pOperNode
=
(
SOperatorNode
*
)
pNode
;
extractEqualOnCondColsFromOper
(
pInfo
,
pDownStream
,
pOperNode
,
&
left
,
&
right
);
taosArrayPush
(
leftTagEqCols
,
&
left
);
...
...
@@ -132,8 +132,8 @@ static void extractTagEqualCondCols(SJoinOperatorInfo* pInfo, SOperatorInfo** pD
return
;
}
if
(
nodeType
(
p
TagEqual
Node
)
==
QUERY_NODE_OPERATOR
)
{
SOperatorNode
*
pOperNode
=
(
SOperatorNode
*
)
p
TagEqual
Node
;
if
(
nodeType
(
p
EqualOnCond
Node
)
==
QUERY_NODE_OPERATOR
)
{
SOperatorNode
*
pOperNode
=
(
SOperatorNode
*
)
p
EqualOnCond
Node
;
extractEqualOnCondColsFromOper
(
pInfo
,
pDownStream
,
pOperNode
,
&
left
,
&
right
);
taosArrayPush
(
leftTagEqCols
,
&
left
);
taosArrayPush
(
rightTagEqCols
,
&
right
);
...
...
@@ -259,11 +259,11 @@ SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t
pInfo
->
inputOrder
=
TSDB_ORDER_DESC
;
}
pInfo
->
p
EqualOnConditions
=
pJoinNode
->
pEqualOnCond
tions
;
if
(
pInfo
->
pEqualOnConditions
!=
NULL
)
{
pInfo
->
p
ColEqualOnConditions
=
pJoinNode
->
pColEqualOnCondi
tions
;
if
(
pInfo
->
p
Col
EqualOnConditions
!=
NULL
)
{
pInfo
->
leftEqOnCondCols
=
taosArrayInit
(
4
,
sizeof
(
SColumn
));
pInfo
->
rightEqOnCondCols
=
taosArrayInit
(
4
,
sizeof
(
SColumn
));
extract
TagEqualCondCols
(
pInfo
,
pDownstream
,
pInfo
->
p
EqualOnConditions
,
pInfo
->
leftEqOnCondCols
,
pInfo
->
rightEqOnCondCols
);
extract
EqualOnCondCols
(
pInfo
,
pDownstream
,
pInfo
->
pCol
EqualOnConditions
,
pInfo
->
leftEqOnCondCols
,
pInfo
->
rightEqOnCondCols
);
initTagColskeyBuf
(
&
pInfo
->
leftEqOnCondKeyLen
,
&
pInfo
->
leftEqOnCondKeyBuf
,
pInfo
->
leftEqOnCondCols
);
initTagColskeyBuf
(
&
pInfo
->
rightEqOnCondKeyLen
,
&
pInfo
->
rightEqOnCondKeyBuf
,
pInfo
->
rightEqOnCondCols
);
_hash_fn_t
hashFn
=
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
);
...
...
@@ -309,7 +309,7 @@ static void mergeJoinDestoryBuildTable(SSHashObj* pBuildTable) {
void
destroyMergeJoinOperator
(
void
*
param
)
{
SJoinOperatorInfo
*
pJoinOperator
=
(
SJoinOperatorInfo
*
)
param
;
if
(
pJoinOperator
->
pEqualOnConditions
!=
NULL
)
{
if
(
pJoinOperator
->
p
Col
EqualOnConditions
!=
NULL
)
{
mergeJoinDestoryBuildTable
(
pJoinOperator
->
rightBuildTable
);
taosMemoryFreeClear
(
pJoinOperator
->
rightEqOnCondKeyBuf
);
taosArrayDestroy
(
pJoinOperator
->
rightEqOnCondCols
);
...
...
@@ -567,7 +567,7 @@ static int32_t mergeJoinJoinDownstreamTsRanges(SOperatorInfo* pOperator, int64_t
pJoinInfo
->
leftPos
,
timestamp
,
leftRowLocations
,
leftCreatedBlocks
);
mergeJoinGetDownStreamRowsEqualTimeStamp
(
pOperator
,
1
,
pJoinInfo
->
rightCol
.
slotId
,
pJoinInfo
->
pRight
,
pJoinInfo
->
rightPos
,
timestamp
,
rightRowLocations
,
rightCreatedBlocks
);
if
(
pJoinInfo
->
pEqualOnConditions
!=
NULL
&&
taosArrayGetSize
(
rightRowLocations
)
>
16
)
{
if
(
pJoinInfo
->
p
Col
EqualOnConditions
!=
NULL
&&
taosArrayGetSize
(
rightRowLocations
)
>
16
)
{
mergeJoinFillBuildTable
(
pJoinInfo
,
rightRowLocations
);
rightUseBuildTable
=
true
;
taosArrayDestroy
(
rightRowLocations
);
...
...
source/libs/nodes/src/nodesCloneFuncs.c
浏览文件 @
f9da4abd
...
...
@@ -401,7 +401,7 @@ static int32_t logicJoinCopy(const SJoinLogicNode* pSrc, SJoinLogicNode* pDst) {
COPY_SCALAR_FIELD
(
joinType
);
CLONE_NODE_FIELD
(
pMergeCondition
);
CLONE_NODE_FIELD
(
pOnConditions
);
CLONE_NODE_FIELD
(
pEqualOnConditions
);
CLONE_NODE_FIELD
(
p
Col
EqualOnConditions
);
COPY_SCALAR_FIELD
(
isSingleTableJoin
);
COPY_SCALAR_FIELD
(
inputTsOrder
);
return
TSDB_CODE_SUCCESS
;
...
...
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
f9da4abd
...
...
@@ -1416,7 +1416,7 @@ static int32_t jsonToLogicPlan(const SJson* pJson, void* pObj) {
static
const
char
*
jkJoinLogicPlanJoinType
=
"JoinType"
;
static
const
char
*
jkJoinLogicPlanOnConditions
=
"OnConditions"
;
static
const
char
*
jkJoinLogicPlanMergeCondition
=
"MergeConditions"
;
static
const
char
*
jkJoinLogicPlan
TagEqualConditions
=
"TagEqual
Conditions"
;
static
const
char
*
jkJoinLogicPlan
ColEqualOnConditions
=
"ColumnEqualOn
Conditions"
;
static
int32_t
logicJoinNodeToJson
(
const
void
*
pObj
,
SJson
*
pJson
)
{
const
SJoinLogicNode
*
pNode
=
(
const
SJoinLogicNode
*
)
pObj
;
...
...
@@ -1432,7 +1432,7 @@ static int32_t logicJoinNodeToJson(const void* pObj, SJson* pJson) {
code
=
tjsonAddObject
(
pJson
,
jkJoinLogicPlanOnConditions
,
nodeToJson
,
pNode
->
pOnConditions
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddObject
(
pJson
,
jkJoinLogicPlan
TagEqualConditions
,
nodeToJson
,
pNode
->
p
EqualOnConditions
);
code
=
tjsonAddObject
(
pJson
,
jkJoinLogicPlan
ColEqualOnConditions
,
nodeToJson
,
pNode
->
pCol
EqualOnConditions
);
}
return
code
;
}
...
...
@@ -1451,7 +1451,7 @@ static int32_t jsonToLogicJoinNode(const SJson* pJson, void* pObj) {
code
=
jsonToNodeObject
(
pJson
,
jkJoinLogicPlanOnConditions
,
&
pNode
->
pOnConditions
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkJoinLogicPlan
TagEqualConditions
,
&
pNode
->
p
EqualOnConditions
);
code
=
jsonToNodeObject
(
pJson
,
jkJoinLogicPlan
ColEqualOnConditions
,
&
pNode
->
pCol
EqualOnConditions
);
}
return
code
;
}
...
...
@@ -1883,7 +1883,7 @@ static const char* jkJoinPhysiPlanInputTsOrder = "InputTsOrder";
static
const
char
*
jkJoinPhysiPlanMergeCondition
=
"MergeCondition"
;
static
const
char
*
jkJoinPhysiPlanOnConditions
=
"OnConditions"
;
static
const
char
*
jkJoinPhysiPlanTargets
=
"Targets"
;
static
const
char
*
jkJoinPhysiPlan
TagEqualConditions
=
"TagEqual
Conditions"
;
static
const
char
*
jkJoinPhysiPlan
ColEqualOnConditions
=
"ColumnEqualOn
Conditions"
;
static
int32_t
physiJoinNodeToJson
(
const
void
*
pObj
,
SJson
*
pJson
)
{
const
SSortMergeJoinPhysiNode
*
pNode
=
(
const
SSortMergeJoinPhysiNode
*
)
pObj
;
...
...
@@ -1905,7 +1905,7 @@ static int32_t physiJoinNodeToJson(const void* pObj, SJson* pJson) {
code
=
nodeListToJson
(
pJson
,
jkJoinPhysiPlanTargets
,
pNode
->
pTargets
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddObject
(
pJson
,
jkJoinPhysiPlan
TagEqualConditions
,
nodeToJson
,
pNode
->
pEqualOnCond
tions
);
code
=
tjsonAddObject
(
pJson
,
jkJoinPhysiPlan
ColEqualOnConditions
,
nodeToJson
,
pNode
->
pColEqualOnCondi
tions
);
}
return
code
;
}
...
...
@@ -1930,7 +1930,7 @@ static int32_t jsonToPhysiJoinNode(const SJson* pJson, void* pObj) {
code
=
jsonToNodeList
(
pJson
,
jkJoinPhysiPlanTargets
,
&
pNode
->
pTargets
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkJoinPhysiPlan
TagEqualConditions
,
&
pNode
->
pEqualOnCond
tions
);
code
=
jsonToNodeObject
(
pJson
,
jkJoinPhysiPlan
ColEqualOnConditions
,
&
pNode
->
pColEqualOnCondi
tions
);
}
return
code
;
}
...
...
source/libs/nodes/src/nodesMsgFuncs.c
浏览文件 @
f9da4abd
...
...
@@ -2341,7 +2341,7 @@ static int32_t physiJoinNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
code
=
tlvEncodeEnum
(
pEncoder
,
PHY_SORT_MERGE_JOIN_CODE_INPUT_TS_ORDER
,
pNode
->
inputTsOrder
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tlvEncodeObj
(
pEncoder
,
PHY_SORT_MERGE_JOIN_CODE_TAG_EQUAL_CONDITIONS
,
nodeToMsg
,
pNode
->
p
EqualOnCond
tions
);
code
=
tlvEncodeObj
(
pEncoder
,
PHY_SORT_MERGE_JOIN_CODE_TAG_EQUAL_CONDITIONS
,
nodeToMsg
,
pNode
->
p
ColEqualOnCondi
tions
);
}
return
code
;
}
...
...
@@ -2372,7 +2372,7 @@ static int32_t msgToPhysiJoinNode(STlvDecoder* pDecoder, void* pObj) {
code
=
tlvDecodeEnum
(
pTlv
,
&
pNode
->
inputTsOrder
,
sizeof
(
pNode
->
inputTsOrder
));
break
;
case
PHY_SORT_MERGE_JOIN_CODE_TAG_EQUAL_CONDITIONS
:
code
=
msgToNodeFromTlv
(
pTlv
,
(
void
**
)
&
pNode
->
p
EqualOnCond
tions
);
code
=
msgToNodeFromTlv
(
pTlv
,
(
void
**
)
&
pNode
->
p
ColEqualOnCondi
tions
);
break
;
default:
break
;
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
f9da4abd
...
...
@@ -1072,7 +1072,7 @@ void nodesDestroyNode(SNode* pNode) {
destroyLogicNode
((
SLogicNode
*
)
pLogicNode
);
nodesDestroyNode
(
pLogicNode
->
pMergeCondition
);
nodesDestroyNode
(
pLogicNode
->
pOnConditions
);
nodesDestroyNode
(
pLogicNode
->
pEqualOnConditions
);
nodesDestroyNode
(
pLogicNode
->
p
Col
EqualOnConditions
);
break
;
}
case
QUERY_NODE_LOGIC_PLAN_AGG
:
{
...
...
@@ -1205,7 +1205,7 @@ void nodesDestroyNode(SNode* pNode) {
nodesDestroyNode
(
pPhyNode
->
pMergeCondition
);
nodesDestroyNode
(
pPhyNode
->
pOnConditions
);
nodesDestroyList
(
pPhyNode
->
pTargets
);
nodesDestroyNode
(
pPhyNode
->
p
EqualOnCond
tions
);
nodesDestroyNode
(
pPhyNode
->
p
ColEqualOnCondi
tions
);
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_HASH_AGG
:
{
...
...
source/libs/planner/src/planOptimizer.c
浏览文件 @
f9da4abd
...
...
@@ -779,24 +779,24 @@ static int32_t pushDownCondOptJoinExtractEqualOnLogicCond(SJoinLogicNode* pJoin)
SLogicConditionNode
*
pLogicCond
=
(
SLogicConditionNode
*
)(
pJoin
->
pOnConditions
);
int32_t
code
=
TSDB_CODE_SUCCESS
;
SNodeList
*
p
TagEqual
Conds
=
NULL
;
SNodeList
*
p
EqualOn
Conds
=
NULL
;
SNode
*
pCond
=
NULL
;
FOREACH
(
pCond
,
pLogicCond
->
pParameterList
)
{
if
(
pushDownCondOptIsEqualOnCond
(
pJoin
,
pCond
))
{
code
=
nodesListMakeAppend
(
&
p
TagEqual
Conds
,
nodesCloneNode
(
pCond
));
code
=
nodesListMakeAppend
(
&
p
EqualOn
Conds
,
nodesCloneNode
(
pCond
));
}
}
SNode
*
pTempTagEqCond
=
NULL
;
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
nodesMergeConds
(
&
pTempTagEqCond
,
&
p
TagEqual
Conds
);
code
=
nodesMergeConds
(
&
pTempTagEqCond
,
&
p
EqualOn
Conds
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
pJoin
->
pEqualOnConditions
=
pTempTagEqCond
;
pJoin
->
p
Col
EqualOnConditions
=
pTempTagEqCond
;
return
TSDB_CODE_SUCCESS
;
}
else
{
nodesDestroyList
(
p
TagEqual
Conds
);
nodesDestroyList
(
p
EqualOn
Conds
);
return
TSDB_CODE_PLAN_INTERNAL_ERROR
;
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -804,7 +804,7 @@ static int32_t pushDownCondOptJoinExtractEqualOnLogicCond(SJoinLogicNode* pJoin)
static
int32_t
pushDownCondOptJoinExtractEqualOnCond
(
SOptimizeContext
*
pCxt
,
SJoinLogicNode
*
pJoin
)
{
if
(
NULL
==
pJoin
->
pOnConditions
)
{
pJoin
->
pEqualOnConditions
=
NULL
;
pJoin
->
p
Col
EqualOnConditions
=
NULL
;
return
TSDB_CODE_SUCCESS
;
}
if
(
QUERY_NODE_LOGIC_CONDITION
==
nodeType
(
pJoin
->
pOnConditions
)
&&
...
...
@@ -813,7 +813,7 @@ static int32_t pushDownCondOptJoinExtractEqualOnCond(SOptimizeContext* pCxt, SJo
}
if
(
pushDownCondOptIsEqualOnCond
(
pJoin
,
pJoin
->
pOnConditions
))
{
pJoin
->
pEqualOnConditions
=
nodesCloneNode
(
pJoin
->
pOnConditions
);
pJoin
->
p
Col
EqualOnConditions
=
nodesCloneNode
(
pJoin
->
pOnConditions
);
}
return
TSDB_CODE_SUCCESS
;
...
...
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
f9da4abd
...
...
@@ -705,8 +705,8 @@ static int32_t createJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren
pJoinLogicNode
->
pOnConditions
,
&
pJoin
->
pOnConditions
);
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
!=
pJoinLogicNode
->
pEqualOnConditions
)
{
code
=
setNodeSlotId
(
pCxt
,
pLeftDesc
->
dataBlockId
,
pRightDesc
->
dataBlockId
,
pJoinLogicNode
->
p
EqualOnConditions
,
&
pJoin
->
pEqualOnCond
tions
);
if
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
!=
pJoinLogicNode
->
p
Col
EqualOnConditions
)
{
code
=
setNodeSlotId
(
pCxt
,
pLeftDesc
->
dataBlockId
,
pRightDesc
->
dataBlockId
,
pJoinLogicNode
->
p
ColEqualOnConditions
,
&
pJoin
->
pColEqualOnCondi
tions
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
setConditionsSlotId
(
pCxt
,
(
const
SLogicNode
*
)
pJoinLogicNode
,
(
SPhysiNode
*
)
pJoin
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录