提交 61309862 编写于 作者: W wangjiaming0909

fix comments of TD-24656

上级 fb4f174f
......@@ -189,7 +189,6 @@ static SSDataBlock* eventWindowAggregate(SOperatorInfo* pOperator) {
SSDataBlock* pRes = pInfo->binfo.pRes;
blockDataCleanup(pRes);
pRes->info.scanFlag = MAIN_SCAN;
SOperatorInfo* downstream = pOperator->pDownstream[0];
while (1) {
......@@ -198,6 +197,7 @@ static SSDataBlock* eventWindowAggregate(SOperatorInfo* pOperator) {
break;
}
pRes->info.scanFlag = pBlock->info.scanFlag;
setInputDataBlock(pSup, pBlock, order, MAIN_SCAN, true);
blockDataUpdateTsWindow(pBlock, pInfo->tsSlotId);
......
......@@ -798,7 +798,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
SOperatorInfo* downstream = pOperator->pDownstream[0];
blockDataCleanup(pResBlock);
pResBlock->info.scanFlag = MAIN_SCAN;
while (1) {
if (pSliceInfo->pNextGroupRes != NULL) {
......@@ -815,6 +814,7 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
break;
}
pResBlock->info.scanFlag = pBlock->info.scanFlag;
if (pSliceInfo->groupId == 0 && pBlock->info.id.groupId != 0) {
pSliceInfo->groupId = pBlock->info.id.groupId;
} else {
......
......@@ -1162,13 +1162,13 @@ static int32_t openStateWindowAggOptr(SOperatorInfo* pOperator) {
int64_t st = taosGetTimestampUs();
SOperatorInfo* downstream = pOperator->pDownstream[0];
pInfo->binfo.pRes->info.scanFlag = MAIN_SCAN;
while (1) {
SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream);
if (pBlock == NULL) {
break;
}
pInfo->binfo.pRes->info.scanFlag = pBlock->info.scanFlag;
setInputDataBlock(pSup, pBlock, order, MAIN_SCAN, true);
blockDataUpdateTsWindow(pBlock, pInfo->tsSlotId);
......@@ -1804,7 +1804,6 @@ static SSDataBlock* doSessionWindowAgg(SOperatorInfo* pOperator) {
int64_t st = taosGetTimestampUs();
int32_t order = pInfo->binfo.inputTsOrder;
pBInfo->pRes->info.scanFlag = MAIN_SCAN;
SOperatorInfo* downstream = pOperator->pDownstream[0];
......@@ -1814,6 +1813,7 @@ static SSDataBlock* doSessionWindowAgg(SOperatorInfo* pOperator) {
break;
}
pBInfo->pRes->info.scanFlag = pBlock->info.scanFlag;
// the pDataBlock are always the same one, no need to call this again
setInputDataBlock(pSup, pBlock, order, MAIN_SCAN, true);
blockDataUpdateTsWindow(pBlock, pInfo->tsSlotId);
......
......@@ -1058,7 +1058,6 @@ static int32_t createSortLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
projIdx++;
}
}
pSort->node.outputTsOrder = firstSortKey->order;
}
if (TSDB_CODE_SUCCESS == code) {
......
......@@ -2895,13 +2895,24 @@ static SSortLogicNode* sortNonPriKeySatisfied(SLogicNode* pNode) {
return NULL;
}
SSortLogicNode* pSort = (SSortLogicNode*)pNode;
if (sortPriKeyOptIsPriKeyOrderBy(pSort->pSortKeys) || 1 != LIST_LENGTH(pSort->node.pChildren)) {
if (sortPriKeyOptIsPriKeyOrderBy(pSort->pSortKeys)) {
return NULL;
}
SNode* pSortKeyNode = NULL, *pSortKeyExpr = NULL;
FOREACH(pSortKeyNode, pSort->pSortKeys) {
pSortKeyExpr = ((SOrderByExprNode*)pSortKeyNode)->pExpr;
switch (nodeType(pSortKeyExpr)) {
case QUERY_NODE_COLUMN:
break;
case QUERY_NODE_VALUE:
continue;
default:
return NULL;
}
}
SNode* pSortKeyNode = ((SOrderByExprNode*)nodesListGetNode(pSort->pSortKeys, 0))->pExpr;
if (nodeType(pSortKeyNode) != QUERY_NODE_COLUMN || ((SColumnNode*)pSortKeyNode)->projIdx != 1 ||
((SColumnNode*)pSortKeyNode)->node.resType.type != TSDB_DATA_TYPE_TIMESTAMP) {
if (!pSortKeyExpr || ((SColumnNode*)pSortKeyExpr)->projIdx != 1 ||
((SColumnNode*)pSortKeyExpr)->node.resType.type != TSDB_DATA_TYPE_TIMESTAMP) {
return NULL;
}
return pSort;
......
......@@ -1573,7 +1573,6 @@ static int32_t createMergePhysiNode(SPhysiPlanContext* pCxt, SMergeLogicNode* pM
pMerge->srcGroupId = pMergeLogicNode->srcGroupId;
pMerge->groupSort = pMergeLogicNode->groupSort;
pMerge->ignoreGroupId = pMergeLogicNode->ignoreGroupId;
pMerge->node.inputTsOrder = pMergeLogicNode->node.outputTsOrder;
int32_t code = addDataBlockSlots(pCxt, pMergeLogicNode->pInputs, pMerge->node.pOutputDataBlockDesc);
......
......@@ -534,7 +534,7 @@ static int32_t stbSplGetNumOfVgroups(SLogicNode* pNode) {
static int32_t stbSplRewriteFromMergeNode(SMergeLogicNode* pMerge, SLogicNode* pNode) {
int32_t code = TSDB_CODE_SUCCESS;
pMerge->node.inputTsOrder = pNode->inputTsOrder;
pMerge->node.inputTsOrder = pNode->outputTsOrder;
pMerge->node.outputTsOrder = pNode->outputTsOrder;
switch (nodeType(pNode)) {
......
......@@ -672,7 +672,7 @@ QUERY_PLAN: Output: Ignore Group Id: true
*************************** 9.row ***************************
QUERY_PLAN: Merge ResBlocks: True
*************************** 10.row ***************************
QUERY_PLAN: -> Sort input_order=asc output_order=asc (columns=3 width=24)
QUERY_PLAN: -> Sort input_order=asc output_order=unknown (columns=3 width=24)
*************************** 11.row ***************************
QUERY_PLAN: Output: columns=3 width=24
*************************** 12.row ***************************
......@@ -748,7 +748,7 @@ QUERY_PLAN: Output: Ignore Group Id: true
*************************** 9.row ***************************
QUERY_PLAN: Merge ResBlocks: True
*************************** 10.row ***************************
QUERY_PLAN: -> Sort input_order=asc output_order=desc (columns=3 width=24)
QUERY_PLAN: -> Sort input_order=asc output_order=unknown (columns=3 width=24)
*************************** 11.row ***************************
QUERY_PLAN: Output: columns=3 width=24
*************************** 12.row ***************************
......@@ -824,7 +824,7 @@ QUERY_PLAN: Output: Ignore Group Id: true
*************************** 9.row ***************************
QUERY_PLAN: Merge ResBlocks: True
*************************** 10.row ***************************
QUERY_PLAN: -> Sort input_order=asc output_order=asc (columns=3 width=24)
QUERY_PLAN: -> Sort input_order=asc output_order=unknown (columns=3 width=24)
*************************** 11.row ***************************
QUERY_PLAN: Output: columns=3 width=24
*************************** 12.row ***************************
......@@ -900,7 +900,7 @@ QUERY_PLAN: Output: Ignore Group Id: true
*************************** 9.row ***************************
QUERY_PLAN: Merge ResBlocks: True
*************************** 10.row ***************************
QUERY_PLAN: -> Sort input_order=asc output_order=desc (columns=3 width=24)
QUERY_PLAN: -> Sort input_order=asc output_order=unknown (columns=3 width=24)
*************************** 11.row ***************************
QUERY_PLAN: Output: columns=3 width=24
*************************** 12.row ***************************
......@@ -976,7 +976,7 @@ QUERY_PLAN: Output: Ignore Group Id: true
*************************** 9.row ***************************
QUERY_PLAN: Merge ResBlocks: True
*************************** 10.row ***************************
QUERY_PLAN: -> Sort input_order=asc output_order=asc (columns=3 width=24)
QUERY_PLAN: -> Sort input_order=asc output_order=unknown (columns=3 width=24)
*************************** 11.row ***************************
QUERY_PLAN: Output: columns=3 width=24
*************************** 12.row ***************************
......@@ -1052,7 +1052,7 @@ QUERY_PLAN: Output: Ignore Group Id: true
*************************** 9.row ***************************
QUERY_PLAN: Merge ResBlocks: True
*************************** 10.row ***************************
QUERY_PLAN: -> Sort input_order=asc output_order=desc (columns=3 width=24)
QUERY_PLAN: -> Sort input_order=asc output_order=unknown (columns=3 width=24)
*************************** 11.row ***************************
QUERY_PLAN: Output: columns=3 width=24
*************************** 12.row ***************************
......@@ -1128,7 +1128,7 @@ QUERY_PLAN: Output: Ignore Group Id: true
*************************** 9.row ***************************
QUERY_PLAN: Merge ResBlocks: True
*************************** 10.row ***************************
QUERY_PLAN: -> Sort input_order=asc output_order=asc (columns=3 width=24)
QUERY_PLAN: -> Sort input_order=asc output_order=unknown (columns=3 width=24)
*************************** 11.row ***************************
QUERY_PLAN: Output: columns=3 width=24
*************************** 12.row ***************************
......@@ -1204,7 +1204,7 @@ QUERY_PLAN: Output: Ignore Group Id: true
*************************** 9.row ***************************
QUERY_PLAN: Merge ResBlocks: True
*************************** 10.row ***************************
QUERY_PLAN: -> Sort input_order=asc output_order=desc (columns=3 width=24)
QUERY_PLAN: -> Sort input_order=asc output_order=unknown (columns=3 width=24)
*************************** 11.row ***************************
QUERY_PLAN: Output: columns=3 width=24
*************************** 12.row ***************************
......@@ -1288,7 +1288,7 @@ QUERY_PLAN: Output: Ignore Group Id: true
*************************** 13.row ***************************
QUERY_PLAN: Merge ResBlocks: False
*************************** 14.row ***************************
QUERY_PLAN: -> Sort input_order=asc output_order=asc (columns=3 width=24)
QUERY_PLAN: -> Sort input_order=asc output_order=unknown (columns=3 width=24)
*************************** 15.row ***************************
QUERY_PLAN: Output: columns=3 width=24
*************************** 16.row ***************************
......@@ -1824,7 +1824,7 @@ taos> select _wstart, first(a) as d, avg(c) from (select _wstart as a, last(ts)
taos> explain verbose true select _wstart, first(a) as d, avg(c) from (select _wstart as a, last(ts) as b, avg(c2) as c from meters interval(10s) order by a desc) where a > '2022-05-15 00:01:00.000' and a < '2022-05-21 00:01:08.000' interval(5h) fill(linear) order by d desc\G;
*************************** 1.row ***************************
QUERY_PLAN: -> Sort input_order=asc output_order=desc (columns=3 width=24)
QUERY_PLAN: -> Sort input_order=asc output_order=unknown (columns=3 width=24)
*************************** 2.row ***************************
QUERY_PLAN: Output: columns=3 width=24
*************************** 3.row ***************************
......@@ -1906,7 +1906,7 @@ QUERY_PLAN: Time Range: [-9223372036854775808, 922
taos> explain verbose true select _wstart, first(a) as d, avg(c) from (select _wstart as a, last(ts) as b, avg(c2) as c from meters interval(10s) order by a asc) where a > '2022-05-15 00:01:00.000' and a < '2022-05-21 00:01:08.000' interval(5h) fill(linear) order by d desc\G;
*************************** 1.row ***************************
QUERY_PLAN: -> Sort input_order=asc output_order=desc (columns=3 width=24)
QUERY_PLAN: -> Sort input_order=asc output_order=unknown (columns=3 width=24)
*************************** 2.row ***************************
QUERY_PLAN: Output: columns=3 width=24
*************************** 3.row ***************************
......@@ -1988,7 +1988,7 @@ QUERY_PLAN: Time Range: [-9223372036854775808, 922
taos> explain verbose true select * from (select ts as a, c2 as b from meters order by c2 desc)\G;
*************************** 1.row ***************************
QUERY_PLAN: -> SortMerge (columns=2 width=12 input_order=desc output_order=desc)
QUERY_PLAN: -> SortMerge (columns=2 width=12 input_order=unknown output_order=unknown)
*************************** 2.row ***************************
QUERY_PLAN: Output: columns=2 width=12
*************************** 3.row ***************************
......@@ -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=desc (columns=2 width=12)
QUERY_PLAN: -> Sort input_order=unknown 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=desc (columns=2 width=12)
QUERY_PLAN: -> Sort input_order=unknown output_order=unknown (columns=2 width=12)
*************************** 15.row ***************************
QUERY_PLAN: Output: columns=2 width=12
*************************** 16.row ***************************
......@@ -2062,7 +2062,7 @@ QUERY_PLAN: Output: Ignore Group Id: true
*************************** 6.row ***************************
QUERY_PLAN: Merge ResBlocks: True
*************************** 7.row ***************************
QUERY_PLAN: -> SortMerge (columns=2 width=12 input_order=desc output_order=desc)
QUERY_PLAN: -> SortMerge (columns=2 width=12 input_order=unknown output_order=unknown)
*************************** 8.row ***************************
QUERY_PLAN: Output: columns=2 width=12
*************************** 9.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=desc (columns=2 width=12)
QUERY_PLAN: -> Sort input_order=unknown 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=desc (columns=2 width=12)
QUERY_PLAN: -> Sort input_order=unknown output_order=unknown (columns=2 width=12)
*************************** 21.row ***************************
QUERY_PLAN: Output: columns=2 width=12
*************************** 22.row ***************************
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册