diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 818e7c6b039ffd42c8a8dca32f365f4f8590b508..feaa205c3ef49d988049d7b0253a8ad62facb970 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -4466,13 +4466,18 @@ 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 || functionId == TSDB_FUNC_TS)) { index->colIndex = j; - index->colId = pQuery->pExpr1[j].base.resColId; + index->colId = pExpr->resColId; } } } } + return pOrderColumns; } @@ -4804,7 +4809,7 @@ static SSDataBlock* doArithmeticOperation(void* param, bool* newgroup) { } // Return result of the previous group in the firstly. - if (newgroup && pRes->info.rows > 0) { + if (*newgroup && pRes->info.rows > 0) { pArithInfo->existDataBlock = pBlock; clearNumOfRes(pInfo->pCtx, pOperator->numOfOutput); return pInfo->pRes; diff --git a/tests/script/general/parser/binary_escapeCharacter.sim b/tests/script/general/parser/binary_escapeCharacter.sim index f0589d154f9fc91da50e8d83e76da1d32939bcc1..d3a0d3ea64a47d33b4dbe0767d8a937bca89a05d 100644 --- a/tests/script/general/parser/binary_escapeCharacter.sim +++ b/tests/script/general/parser/binary_escapeCharacter.sim @@ -1,3 +1,4 @@ + system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 diff --git a/tests/script/general/parser/testSuite.sim b/tests/script/general/parser/testSuite.sim index 62af4818e58b4466074c9d50d13e04bae8ec4ec2..8e764f9670f461667ea34a71b1e1fbcec9ce71e7 100644 --- a/tests/script/general/parser/testSuite.sim +++ b/tests/script/general/parser/testSuite.sim @@ -55,4 +55,5 @@ run general/parser/sliding.sim run general/parser/function.sim run general/parser/stableOp.sim run general/parser/having.sim -run general/parser/having_child.sim \ No newline at end of file +run general/parser/having_child.sim +run general/parser/binary_escapeCharacter.sim