From 9d217d864fea61e53862e01e9f558ed6b17a4fec Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 30 Apr 2021 13:58:33 +0800 Subject: [PATCH] [td-225]fix the bug found by regression test. --- src/client/src/tscLocalMerge.c | 1 - src/query/src/qExecutor.c | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/client/src/tscLocalMerge.c b/src/client/src/tscLocalMerge.c index e989c91efc..a4bfa4f38f 100644 --- a/src/client/src/tscLocalMerge.c +++ b/src/client/src/tscLocalMerge.c @@ -1094,7 +1094,6 @@ SSDataBlock* doGlobalAggregate(void* param, bool* newgroup) { { if (pAggInfo->hasDataBlockForNewGroup) { - pAggInfo->binfo.pRes->info.rows = 0; pAggInfo->hasPrev = false; // now we start from a new group data set. // not belongs to the same group, return the result of current group; diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 42ab37111b..3092a29e96 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -4578,9 +4578,12 @@ SArray* getOrderCheckColumns(SQueryAttr* pQuery) { for(int32_t i = 0; i < numOfCols; ++i) { SColIndex* index = taosArrayGet(pOrderColumns, i); for(int32_t j = 0; j < pQuery->numOfOutput; ++j) { - if (index->colId == pQuery->pExpr1[j].base.colInfo.colId) { + SSqlExpr* pExpr = &pQuery->pExpr1[j].base; + int32_t functionId = pExpr->functionId; + + if (index->colId == pExpr->colInfo.colId && (functionId == TSDB_FUNC_PRJ || functionId == TSDB_FUNC_TAG)) { index->colIndex = j; - index->colId = pQuery->pExpr1[j].base.resColId; + index->colId = pExpr->resColId; } } } -- GitLab