fix: orderby
This commit is contained in:
parent
b6b2a41d83
commit
8dc2a6bbd9
|
@ -273,6 +273,7 @@ SSDataBlock* getAggregateResult(SOperatorInfo* pOperator) {
|
|||
}
|
||||
|
||||
int32_t doAggregateImpl(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
for (int32_t k = 0; k < pOperator->exprSupp.numOfExprs; ++k) {
|
||||
if (functionNeedToExecute(&pCtx[k])) {
|
||||
// todo add a dummy funtion to avoid process check
|
||||
|
@ -280,7 +281,13 @@ int32_t doAggregateImpl(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx) {
|
|||
continue;
|
||||
}
|
||||
|
||||
int32_t code = pCtx[k].fpSet.process(&pCtx[k]);
|
||||
if ((&pCtx[k])->input.pData[0] == NULL) {
|
||||
code = TSDB_CODE_TDB_INVALID_ACTION;
|
||||
qError("%s aggregate function error happens, input data is NULL.", GET_TASKID(pOperator->pTaskInfo));
|
||||
} else {
|
||||
code = pCtx[k].fpSet.process(&pCtx[k]);
|
||||
}
|
||||
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
qError("%s aggregate function error happens, code: %s", GET_TASKID(pOperator->pTaskInfo), tstrerror(code));
|
||||
return code;
|
||||
|
|
|
@ -3442,7 +3442,7 @@ static int32_t checkOrderByAggForGroupBy(STranslateContext* pCxt, SSelectStmt* p
|
|||
if ((QUERY_NODE_FUNCTION == nodeType(pExpr))) {
|
||||
SFunctionNode* pFunc = (SFunctionNode*)pExpr;
|
||||
if (fmIsAggFunc(pFunc->funcId)) {
|
||||
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION);
|
||||
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_SINGLE_GROUP);
|
||||
}
|
||||
}
|
||||
WHERE_NEXT;
|
||||
|
@ -3501,9 +3501,9 @@ static int32_t translateOrderBy(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
|||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = checkExprListForGroupBy(pCxt, pSelect, pSelect->pOrderByList);
|
||||
}
|
||||
if (other && TSDB_CODE_SUCCESS == code) {
|
||||
code = checkOrderByAggForGroupBy(pCxt, pSelect, pSelect->pOrderByList);
|
||||
}
|
||||
// if (other && TSDB_CODE_SUCCESS == code) {
|
||||
// code = checkOrderByAggForGroupBy(pCxt, pSelect, pSelect->pOrderByList);
|
||||
// }
|
||||
return code;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue