[td-225] fix bug found by regression test.

This commit is contained in:
Haojun Liao 2021-04-30 16:38:37 +08:00
parent 006d59bfd7
commit 6216f6c519
3 changed files with 11 additions and 4 deletions

View File

@ -4466,13 +4466,18 @@ SArray* getOrderCheckColumns(SQueryAttr* pQuery) {
for(int32_t i = 0; i < numOfCols; ++i) { for(int32_t i = 0; i < numOfCols; ++i) {
SColIndex* index = taosArrayGet(pOrderColumns, i); SColIndex* index = taosArrayGet(pOrderColumns, i);
for(int32_t j = 0; j < pQuery->numOfOutput; ++j) { 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 || functionId == TSDB_FUNC_TS)) {
index->colIndex = j; index->colIndex = j;
index->colId = pQuery->pExpr1[j].base.resColId; index->colId = pExpr->resColId;
} }
} }
} }
} }
return pOrderColumns; return pOrderColumns;
} }
@ -4804,7 +4809,7 @@ static SSDataBlock* doArithmeticOperation(void* param, bool* newgroup) {
} }
// Return result of the previous group in the firstly. // Return result of the previous group in the firstly.
if (newgroup && pRes->info.rows > 0) { if (*newgroup && pRes->info.rows > 0) {
pArithInfo->existDataBlock = pBlock; pArithInfo->existDataBlock = pBlock;
clearNumOfRes(pInfo->pCtx, pOperator->numOfOutput); clearNumOfRes(pInfo->pCtx, pOperator->numOfOutput);
return pInfo->pRes; return pInfo->pRes;

View File

@ -1,3 +1,4 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1

View File

@ -55,4 +55,5 @@ run general/parser/sliding.sim
run general/parser/function.sim run general/parser/function.sim
run general/parser/stableOp.sim run general/parser/stableOp.sim
run general/parser/having.sim run general/parser/having.sim
run general/parser/having_child.sim run general/parser/having_child.sim
run general/parser/binary_escapeCharacter.sim