fix:[TD-31588] Handle error when initFunc failed .

This commit is contained in:
Jing Sima 2024-08-21 16:28:44 +08:00
parent 9b76e216a7
commit 16d314a6ae
1 changed files with 7 additions and 3 deletions

View File

@ -681,6 +681,7 @@ int32_t doApplyIndefinitFunction(SOperatorInfo* pOperator, SSDataBlock** pResBlo
} }
int32_t initCtxOutputBuffer(SqlFunctionCtx* pCtx, int32_t size) { int32_t initCtxOutputBuffer(SqlFunctionCtx* pCtx, int32_t size) {
int32_t code = TSDB_CODE_SUCCESS;
for (int32_t j = 0; j < size; ++j) { for (int32_t j = 0; j < size; ++j) {
struct SResultRowEntryInfo* pResInfo = GET_RES_INFO(&pCtx[j]); struct SResultRowEntryInfo* pResInfo = GET_RES_INFO(&pCtx[j]);
if (isRowEntryInitialized(pResInfo) || fmIsPseudoColumnFunc(pCtx[j].functionId) || pCtx[j].functionId == -1 || if (isRowEntryInitialized(pResInfo) || fmIsPseudoColumnFunc(pCtx[j].functionId) || pCtx[j].functionId == -1 ||
@ -688,7 +689,10 @@ int32_t initCtxOutputBuffer(SqlFunctionCtx* pCtx, int32_t size) {
continue; continue;
} }
(void)pCtx[j].fpSet.init(&pCtx[j], pCtx[j].resultInfo); code = pCtx[j].fpSet.init(&pCtx[j], pCtx[j].resultInfo);
if (code) {
return code;
}
} }
return 0; return 0;
@ -1033,8 +1037,8 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc
// do nothing // do nothing
} else if (fmIsIndefiniteRowsFunc(pfCtx->functionId)) { } else if (fmIsIndefiniteRowsFunc(pfCtx->functionId)) {
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pfCtx); SResultRowEntryInfo* pResInfo = GET_RES_INFO(pfCtx);
(void) pfCtx->fpSet.init(pfCtx, pResInfo); code = pfCtx->fpSet.init(pfCtx, pResInfo);
TSDB_CHECK_CODE(code, lino, _exit);
pfCtx->pOutput = taosArrayGet(pResult->pDataBlock, outputSlotId); pfCtx->pOutput = taosArrayGet(pResult->pDataBlock, outputSlotId);
if (pfCtx->pOutput == NULL) { if (pfCtx->pOutput == NULL) {
code = terrno; code = terrno;