From 6aae3fe9008c0f3d8b44ad96d69995e9a3b30cbb Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Fri, 10 Dec 2021 09:22:26 +0800 Subject: [PATCH] resolve commit comments and change function name --- src/client/inc/tscUtil.h | 2 +- src/client/src/tscGlobalmerge.c | 22 +++++++++------------- src/client/src/tscSubquery.c | 2 +- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h index aeac129bd9..249d0bc4c7 100644 --- a/src/client/inc/tscUtil.h +++ b/src/client/inc/tscUtil.h @@ -364,7 +364,7 @@ bool subAndCheckDone(SSqlObj *pSql, SSqlObj *pParentSql, int idx); bool tscSetSqlOwner(SSqlObj* pSql); void tscClearSqlOwner(SSqlObj* pSql); -int32_t doArithmeticCalculate(SQueryInfo* pQueryInfo, tFilePage* pOutput, int32_t rowSize, int32_t finalRowSize); +int32_t doScalarExprCalculate(SQueryInfo* pQueryInfo, tFilePage* pOutput, int32_t rowSize, int32_t finalRowSize); char* serializeTagData(STagData* pTagData, char* pMsg); int32_t copyTagData(STagData* dst, const STagData* src); diff --git a/src/client/src/tscGlobalmerge.c b/src/client/src/tscGlobalmerge.c index 68677423d4..9f3e21f6b8 100644 --- a/src/client/src/tscGlobalmerge.c +++ b/src/client/src/tscGlobalmerge.c @@ -605,10 +605,9 @@ static void doMergeResultImpl(SMultiwayMergeInfo* pInfo, SQLFunctionCtx *pCtx, i if (functionId < 0) { SUdfInfo* pUdfInfo = taosArrayGet(pInfo->udfInfo, -1 * functionId - 1); doInvokeUdf(pUdfInfo, &pCtx[j], 0, TSDB_UDF_FUNC_MERGE); - } else if (!TSDB_FUNC_IS_SCALAR(functionId)){ - aAggs[functionId].mergeFunc(&pCtx[j]); } else { - assert(0); + assert(!TSDB_FUNC_IS_SCALAR(functionId)); + aAggs[functionId].mergeFunc(&pCtx[j]); } } } @@ -623,10 +622,9 @@ static void doFinalizeResultImpl(SMultiwayMergeInfo* pInfo, SQLFunctionCtx *pCtx if (functionId < 0) { SUdfInfo* pUdfInfo = taosArrayGet(pInfo->udfInfo, -1 * functionId - 1); doInvokeUdf(pUdfInfo, &pCtx[j], 0, TSDB_UDF_FUNC_FINALIZE); - } else if (!TSDB_FUNC_IS_SCALAR(functionId)){ - aAggs[functionId].xFinalize(&pCtx[j]); } else { - assert(0); + assert(!TSDB_FUNC_IS_SCALAR(functionId)); + aAggs[functionId].xFinalize(&pCtx[j]); } } } @@ -665,9 +663,8 @@ static void doExecuteFinalMerge(SOperatorInfo* pOperator, int32_t numOfExpr, SSD if (pCtx[j].functionId < 0) { continue; } - if (TSDB_FUNC_IS_SCALAR(pCtx[j].functionId)) { - assert(0); - } else { + { + assert(!TSDB_FUNC_IS_SCALAR(pCtx[j].functionId)); aAggs[pCtx[j].functionId].init(&pCtx[j], pCtx[j].resultInfo); } } @@ -711,7 +708,7 @@ SGlobalMerger* tscInitResObjForLocalQuery(int32_t numOfRes, int32_t rowLen, uint } // todo remove it -int32_t doArithmeticCalculate(SQueryInfo* pQueryInfo, tFilePage* pOutput, int32_t rowSize, int32_t finalRowSize) { +int32_t doScalarExprCalculate(SQueryInfo* pQueryInfo, tFilePage* pOutput, int32_t rowSize, int32_t finalRowSize) { int32_t maxRowSize = MAX(rowSize, finalRowSize); char* pbuf = calloc(1, (size_t)(pOutput->num * maxRowSize)); @@ -912,10 +909,9 @@ SSDataBlock* doGlobalAggregate(void* param, bool* newgroup) { clearOutputBuf(&pAggInfo->binfo, &pAggInfo->bufCapacity); continue; } - if (!TSDB_FUNC_IS_SCALAR(pCtx->functionId)) { + { + assert(!TSDB_IS_FUNC_SCALAR(pCtx->functionId)); aAggs[pCtx->functionId].init(pCtx, pCtx->resultInfo); - } else { - assert(0); } } } diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index d2c8c10ec0..cf6bb46407 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -3600,7 +3600,7 @@ static void doBuildResFromSubqueries(SSqlObj* pSql) { finalRowSize += pField->bytes; } - doArithmeticCalculate(pQueryInfo, pFilePage, rowSize, finalRowSize); + doScalarExprCalculate(pQueryInfo, pFilePage, rowSize, finalRowSize); pRes->data = pFilePage->data; tscSetResRawPtr(pRes, pQueryInfo, pRes->dataConverted); -- GitLab