enh: check param
This commit is contained in:
parent
f3acf49e22
commit
04af5f4b94
|
@ -202,6 +202,14 @@ void * getOperatorParam(int32_t opType, SOperatorParam* param, int32_t i
|
||||||
void doKeepTuple(SWindowRowsSup* pRowSup, int64_t ts, uint64_t groupId);
|
void doKeepTuple(SWindowRowsSup* pRowSup, int64_t ts, uint64_t groupId);
|
||||||
void doKeepNewWindowStartInfo(SWindowRowsSup* pRowSup, const int64_t* tsList, int32_t rowIndex, uint64_t groupId);
|
void doKeepNewWindowStartInfo(SWindowRowsSup* pRowSup, const int64_t* tsList, int32_t rowIndex, uint64_t groupId);
|
||||||
|
|
||||||
|
#define CHECK_CONDITION_FAILED(c) \
|
||||||
|
do { \
|
||||||
|
if (!(c)) { \
|
||||||
|
qError("function:%s condition failed, Line:%d", __FUNCTION__, __LINE__); \
|
||||||
|
return TSDB_CODE_APP_ERROR; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -184,6 +184,10 @@ static bool nextGroupedResult(SOperatorInfo* pOperator) {
|
||||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||||
SAggOperatorInfo* pAggInfo = pOperator->info;
|
SAggOperatorInfo* pAggInfo = pOperator->info;
|
||||||
|
|
||||||
|
if(!pAggInfo) {
|
||||||
|
qError("function:%s, pAggInfo is NULL", __func__);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (pOperator->blocking && pAggInfo->hasValidBlock) {
|
if (pOperator->blocking && pAggInfo->hasValidBlock) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -333,6 +337,10 @@ static SSDataBlock* getAggregateResult(SOperatorInfo* pOperator) {
|
||||||
|
|
||||||
int32_t doAggregateImpl(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx) {
|
int32_t doAggregateImpl(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
if (pOperator || (pOperator->exprSupp.numOfExprs > 0 && pCtx == NULL)) {
|
||||||
|
qError("%s failed at line %d since pCtx is NULL.", __func__, __LINE__);
|
||||||
|
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||||
|
}
|
||||||
for (int32_t k = 0; k < pOperator->exprSupp.numOfExprs; ++k) {
|
for (int32_t k = 0; k < pOperator->exprSupp.numOfExprs; ++k) {
|
||||||
if (functionNeedToExecute(&pCtx[k])) {
|
if (functionNeedToExecute(&pCtx[k])) {
|
||||||
// todo add a dummy function to avoid process check
|
// todo add a dummy function to avoid process check
|
||||||
|
|
|
@ -171,6 +171,10 @@ _error:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t anomalyAggregateNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
|
static int32_t anomalyAggregateNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
|
||||||
|
CHECK_CONDITION_FAILED(pOperator != NULL);
|
||||||
|
CHECK_CONDITION_FAILED(ppRes != NULL);
|
||||||
|
CHECK_CONDITION_FAILED(pOperator->info != NULL);
|
||||||
|
CHECK_CONDITION_FAILED(pOperator->pTaskInfo != NULL);
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
SAnomalyWindowOperatorInfo* pInfo = pOperator->info;
|
SAnomalyWindowOperatorInfo* pInfo = pOperator->info;
|
||||||
|
@ -181,6 +185,7 @@ static int32_t anomalyAggregateNext(SOperatorInfo* pOperator, SSDataBlock** ppRe
|
||||||
int64_t st = taosGetTimestampUs();
|
int64_t st = taosGetTimestampUs();
|
||||||
int32_t numOfBlocks = taosArrayGetSize(pSupp->blocks);
|
int32_t numOfBlocks = taosArrayGetSize(pSupp->blocks);
|
||||||
|
|
||||||
|
CHECK_CONDITION_FAILED(pRes != NULL);
|
||||||
blockDataCleanup(pRes);
|
blockDataCleanup(pRes);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
|
@ -255,6 +255,7 @@ static int32_t doSetInputDataBlockInfo(SExprSupp* pExprSup, SSDataBlock* pBlock,
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
SqlFunctionCtx* pCtx = pExprSup->pCtx;
|
SqlFunctionCtx* pCtx = pExprSup->pCtx;
|
||||||
|
CHECK_CONDITION_FAILED(pExprSup->numOfExprs <= 0 || pCtx != NULL);
|
||||||
for (int32_t i = 0; i < pExprSup->numOfExprs; ++i) {
|
for (int32_t i = 0; i < pExprSup->numOfExprs; ++i) {
|
||||||
pCtx[i].order = order;
|
pCtx[i].order = order;
|
||||||
pCtx[i].input.numOfRows = pBlock->info.rows;
|
pCtx[i].input.numOfRows = pBlock->info.rows;
|
||||||
|
|
Loading…
Reference in New Issue