postfix: propagate ts order to parents for more logic nodes

This commit is contained in:
wangjiaming0909 2023-06-21 09:31:44 +08:00
parent 52cd4f0cbf
commit 632fb40a43
2 changed files with 15 additions and 15 deletions

View File

@ -167,25 +167,25 @@ static bool scanPathOptMayBeOptimized(SLogicNode* pNode) {
if (QUERY_NODE_LOGIC_PLAN_SCAN != nodeType(pNode)) {
return false;
}
if (NULL == pNode->pParent || (QUERY_NODE_LOGIC_PLAN_WINDOW != nodeType(pNode->pParent) &&
QUERY_NODE_LOGIC_PLAN_AGG != nodeType(pNode->pParent) &&
QUERY_NODE_LOGIC_PLAN_PARTITION != nodeType(pNode->pParent))) {
return false;
}
if ((QUERY_NODE_LOGIC_PLAN_WINDOW == nodeType(pNode->pParent) &&
WINDOW_TYPE_INTERVAL == ((SWindowLogicNode*)pNode->pParent)->winType) ||
(QUERY_NODE_LOGIC_PLAN_PARTITION == nodeType(pNode->pParent) && pNode->pParent->pParent &&
QUERY_NODE_LOGIC_PLAN_WINDOW == nodeType(pNode->pParent->pParent) &&
return true;
}
static bool scanPathOptShouldGetFuncs(SLogicNode* pNode) {
if ((QUERY_NODE_LOGIC_PLAN_WINDOW == nodeType(pNode) &&
WINDOW_TYPE_INTERVAL == ((SWindowLogicNode*)pNode)->winType) ||
(QUERY_NODE_LOGIC_PLAN_PARTITION == nodeType(pNode) && pNode->pParent &&
QUERY_NODE_LOGIC_PLAN_WINDOW == nodeType(pNode->pParent) &&
WINDOW_TYPE_INTERVAL == ((SWindowLogicNode*)pNode->pParent)->winType)) {
return true;
}
if (QUERY_NODE_LOGIC_PLAN_AGG == nodeType(pNode->pParent)) {
return !scanPathOptHaveNormalCol(((SAggLogicNode*)pNode->pParent)->pGroupKeys);
if (QUERY_NODE_LOGIC_PLAN_AGG == nodeType(pNode)) {
return !scanPathOptHaveNormalCol(((SAggLogicNode*)pNode)->pGroupKeys);
}
return false;
}
static SNodeList* scanPathOptGetAllFuncs(SLogicNode* pNode) {
if (!scanPathOptShouldGetFuncs(pNode)) return NULL;
switch (nodeType(pNode)) {
case QUERY_NODE_LOGIC_PLAN_WINDOW:
return ((SWindowLogicNode*)pNode)->pFuncs;

View File

@ -2000,7 +2000,7 @@ QUERY_PLAN: -> Data Exchange 1:1 (width=12)
*************************** 6.row ***************************
QUERY_PLAN: Output: columns=2 width=12
*************************** 7.row ***************************
QUERY_PLAN: -> Sort input_order=unknown output_order=unknown (columns=2 width=12)
QUERY_PLAN: -> Sort input_order=asc output_order=unknown (columns=2 width=12)
*************************** 8.row ***************************
QUERY_PLAN: Output: columns=2 width=12
*************************** 9.row ***************************
@ -2014,7 +2014,7 @@ QUERY_PLAN: -> Data Exchange 1:1 (width=12)
*************************** 13.row ***************************
QUERY_PLAN: Output: columns=2 width=12
*************************** 14.row ***************************
QUERY_PLAN: -> Sort input_order=unknown output_order=unknown (columns=2 width=12)
QUERY_PLAN: -> Sort input_order=asc output_order=unknown (columns=2 width=12)
*************************** 15.row ***************************
QUERY_PLAN: Output: columns=2 width=12
*************************** 16.row ***************************
@ -2074,7 +2074,7 @@ QUERY_PLAN: -> Data Exchange 1:1 (width=12)
*************************** 12.row ***************************
QUERY_PLAN: Output: columns=2 width=12
*************************** 13.row ***************************
QUERY_PLAN: -> Sort input_order=unknown output_order=unknown (columns=2 width=12)
QUERY_PLAN: -> Sort input_order=asc output_order=unknown (columns=2 width=12)
*************************** 14.row ***************************
QUERY_PLAN: Output: columns=2 width=12
*************************** 15.row ***************************
@ -2088,7 +2088,7 @@ QUERY_PLAN: -> Data Exchange 1:1 (width=12)
*************************** 19.row ***************************
QUERY_PLAN: Output: columns=2 width=12
*************************** 20.row ***************************
QUERY_PLAN: -> Sort input_order=unknown output_order=unknown (columns=2 width=12)
QUERY_PLAN: -> Sort input_order=asc output_order=unknown (columns=2 width=12)
*************************** 21.row ***************************
QUERY_PLAN: Output: columns=2 width=12
*************************** 22.row ***************************