refactor errno code
This commit is contained in:
parent
61e2f68542
commit
fa2da69e7c
|
@ -882,11 +882,10 @@ static int32_t sifExecLogic(SLogicConditionNode *node, SIFCtx *ctx, SIFParam *ou
|
||||||
if (ctx->noExec == false) {
|
if (ctx->noExec == false) {
|
||||||
for (int32_t m = 0; m < node->pParameterList->length; m++) {
|
for (int32_t m = 0; m < node->pParameterList->length; m++) {
|
||||||
if (node->condType == LOGIC_COND_TYPE_AND) {
|
if (node->condType == LOGIC_COND_TYPE_AND) {
|
||||||
(void)taosArrayAddAll(output->result, params[m].result);
|
if (taosArrayAddAll(output->result, params[m].result) == NULL) return terrno;
|
||||||
} else if (node->condType == LOGIC_COND_TYPE_OR) {
|
} else if (node->condType == LOGIC_COND_TYPE_OR) {
|
||||||
(void)taosArrayAddAll(output->result, params[m].result);
|
if (taosArrayAddAll(output->result, params[m].result) == NULL) return terrno;
|
||||||
} else if (node->condType == LOGIC_COND_TYPE_NOT) {
|
} else if (node->condType == LOGIC_COND_TYPE_NOT) {
|
||||||
// taosArrayAddAll(output->result, params[m].result);
|
|
||||||
}
|
}
|
||||||
taosArraySort(output->result, uidCompare);
|
taosArraySort(output->result, uidCompare);
|
||||||
taosArrayRemoveDuplicate(output->result, uidCompare, NULL);
|
taosArrayRemoveDuplicate(output->result, uidCompare, NULL);
|
||||||
|
@ -894,8 +893,6 @@ static int32_t sifExecLogic(SLogicConditionNode *node, SIFCtx *ctx, SIFParam *ou
|
||||||
} else {
|
} else {
|
||||||
for (int32_t m = 0; m < node->pParameterList->length; m++) {
|
for (int32_t m = 0; m < node->pParameterList->length; m++) {
|
||||||
output->status = sifMergeCond(node->condType, output->status, params[m].status);
|
output->status = sifMergeCond(node->condType, output->status, params[m].status);
|
||||||
// taosArrayDestroy(params[m].result);
|
|
||||||
// params[m].result = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_return:
|
_return:
|
||||||
|
@ -904,7 +901,7 @@ _return:
|
||||||
}
|
}
|
||||||
|
|
||||||
static EDealRes sifWalkFunction(SNode *pNode, void *context) {
|
static EDealRes sifWalkFunction(SNode *pNode, void *context) {
|
||||||
SIFCtx *ctx = context;
|
SIFCtx *ctx = context;
|
||||||
SFunctionNode *node = (SFunctionNode *)pNode;
|
SFunctionNode *node = (SFunctionNode *)pNode;
|
||||||
SIFParam output = {.result = taosArrayInit(8, sizeof(uint64_t)), .status = SFLT_COARSE_INDEX};
|
SIFParam output = {.result = taosArrayInit(8, sizeof(uint64_t)), .status = SFLT_COARSE_INDEX};
|
||||||
if (output.result == NULL) {
|
if (output.result == NULL) {
|
||||||
|
@ -924,7 +921,7 @@ static EDealRes sifWalkFunction(SNode *pNode, void *context) {
|
||||||
return DEAL_RES_CONTINUE;
|
return DEAL_RES_CONTINUE;
|
||||||
}
|
}
|
||||||
static EDealRes sifWalkLogic(SNode *pNode, void *context) {
|
static EDealRes sifWalkLogic(SNode *pNode, void *context) {
|
||||||
SIFCtx *ctx = context;
|
SIFCtx *ctx = context;
|
||||||
SLogicConditionNode *node = (SLogicConditionNode *)pNode;
|
SLogicConditionNode *node = (SLogicConditionNode *)pNode;
|
||||||
|
|
||||||
SIFParam output = {.result = taosArrayInit(8, sizeof(uint64_t)), .status = SFLT_COARSE_INDEX};
|
SIFParam output = {.result = taosArrayInit(8, sizeof(uint64_t)), .status = SFLT_COARSE_INDEX};
|
||||||
|
@ -946,7 +943,7 @@ static EDealRes sifWalkLogic(SNode *pNode, void *context) {
|
||||||
return DEAL_RES_CONTINUE;
|
return DEAL_RES_CONTINUE;
|
||||||
}
|
}
|
||||||
static EDealRes sifWalkOper(SNode *pNode, void *context) {
|
static EDealRes sifWalkOper(SNode *pNode, void *context) {
|
||||||
SIFCtx *ctx = context;
|
SIFCtx *ctx = context;
|
||||||
SOperatorNode *node = (SOperatorNode *)pNode;
|
SOperatorNode *node = (SOperatorNode *)pNode;
|
||||||
SIFParam output = {.result = taosArrayInit(8, sizeof(uint64_t)), .status = SFLT_COARSE_INDEX};
|
SIFParam output = {.result = taosArrayInit(8, sizeof(uint64_t)), .status = SFLT_COARSE_INDEX};
|
||||||
if (output.result == NULL) {
|
if (output.result == NULL) {
|
||||||
|
@ -1029,9 +1026,9 @@ static int32_t sifCalculate(SNode *pNode, SIFParam *pDst) {
|
||||||
SIF_ERR_RET(TSDB_CODE_APP_ERROR);
|
SIF_ERR_RET(TSDB_CODE_APP_ERROR);
|
||||||
}
|
}
|
||||||
if (res->result != NULL) {
|
if (res->result != NULL) {
|
||||||
if (taosArrayAddAll(pDst->result, res->result) == NULL) {
|
if (taosArrayAddAll(pDst->result, res->result) == NULL) {
|
||||||
SIF_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
SIF_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pDst->status = res->status;
|
pDst->status = res->status;
|
||||||
|
|
||||||
|
@ -1090,7 +1087,7 @@ int32_t doFilterTag(SNode *pFilterNode, SIndexMetaArg *metaArg, SArray *result,
|
||||||
|
|
||||||
SFilterInfo *filter = NULL;
|
SFilterInfo *filter = NULL;
|
||||||
|
|
||||||
SArray *output = taosArrayInit(8, sizeof(uint64_t));
|
SArray *output = taosArrayInit(8, sizeof(uint64_t));
|
||||||
if (output == NULL) {
|
if (output == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -1107,11 +1104,13 @@ int32_t doFilterTag(SNode *pFilterNode, SIndexMetaArg *metaArg, SArray *result,
|
||||||
*status = st;
|
*status = st;
|
||||||
}
|
}
|
||||||
|
|
||||||
sifFreeParam(¶m);
|
|
||||||
|
|
||||||
if(taosArrayAddAll(result, param.result) == NULL) {
|
if (taosArrayAddAll(result, param.result) == NULL) {
|
||||||
|
sifFreeParam(¶m);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sifFreeParam(¶m);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue