From 6c6e20ff1473bc0c042cd2d8a176fa2fe6666ef3 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 21 Sep 2022 14:18:27 +0800 Subject: [PATCH] fix(query): fix value number counting in relational processing. --- source/libs/scalar/src/scalar.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index 62f012a75a..ebc8f2665e 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -606,6 +606,8 @@ int32_t sclExecLogic(SLogicConditionNode *node, SScalarCtx *ctx, SScalarParam *o SCL_ERR_JRET(code); } + int32_t numOfQualified = 0; + bool value = false; bool complete = true; for (int32_t i = 0; i < rowNum; ++i) { @@ -631,6 +633,9 @@ int32_t sclExecLogic(SLogicConditionNode *node, SScalarCtx *ctx, SScalarParam *o if (complete) { colDataAppend(output->columnData, i, (char*) &value, false); + if (value) { + numOfQualified++; + } } } @@ -639,8 +644,9 @@ int32_t sclExecLogic(SLogicConditionNode *node, SScalarCtx *ctx, SScalarParam *o output->numOfRows = 0; } -_return: + output->numOfQualified = numOfQualified; +_return: sclFreeParamList(params, paramNum); SCL_RET(code); } @@ -1250,7 +1256,6 @@ int32_t scalarCalculate(SNode *pNode, SArray *pBlockList, SScalarParam *pDst) { } _return: - //nodesDestroyNode(pNode); sclFreeRes(ctx.pRes); return code; }