From 82b96e7222d37481fbfc83d4fd7825d7ce66570e Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Fri, 22 Jul 2022 17:52:56 +0800 Subject: [PATCH] fix: table merge scan order and init data readers array when start group scan --- source/libs/executor/src/scanoperator.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 5101ade68a..0b62cc9bb7 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2893,6 +2893,7 @@ int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) { int32_t tableEndIdx = pInfo->tableEndIndex; STableListInfo* tableListInfo = pInfo->tableListInfo; + pInfo->dataReaders = taosArrayInit(64, POINTER_BYTES); createMultipleDataReaders(&pInfo->cond, &pInfo->readHandle, tableListInfo, tableStartIdx, tableEndIdx, pInfo->dataReaders, GET_TASKID(pTaskInfo)); @@ -3065,10 +3066,10 @@ int32_t getTableMergeScanExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExpla int32_t compareTableKeyInfoByGid(const void* p1, const void* p2) { const STableKeyInfo* info1 = p1; const STableKeyInfo* info2 = p2; - if (info1->groupId - info2->groupId > 0) { - return 1; - } else if (info1->groupId < info2->groupId) { + if (info1->groupId < info2->groupId) { return -1; + } else if (info1->groupId > info2->groupId) { + return 1; } else { return 0; } @@ -3113,7 +3114,6 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN pInfo->pColMatchInfo = pColList; pInfo->pResBlock = createResDataBlock(pDescNode); - pInfo->dataReaders = taosArrayInit(64, POINTER_BYTES); pInfo->sortSourceParams = taosArrayInit(64, sizeof(STableMergeScanSortSourceParam)); pInfo->pSortInfo = generateSortByTsInfo(pInfo->pColMatchInfo, pInfo->cond.order);