fix count scalar function behavior

This commit is contained in:
Ganlin Zhao 2022-07-16 14:07:32 +08:00
parent a57d2417c3
commit 6d63d1b5b8
1 changed files with 1 additions and 7 deletions

View File

@ -1746,20 +1746,14 @@ int32_t countScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam
SColumnInfoData *pOutputData = pOutput->columnData; SColumnInfoData *pOutputData = pOutput->columnData;
int64_t *out = (int64_t *)pOutputData->pData; int64_t *out = (int64_t *)pOutputData->pData;
bool hasNull = false;
*out = 0; *out = 0;
for (int32_t i = 0; i < pInput->numOfRows; ++i) { for (int32_t i = 0; i < pInput->numOfRows; ++i) {
if (colDataIsNull_s(pInputData, i)) { if (colDataIsNull_s(pInputData, i)) {
hasNull = true; continue;
break;
} }
(*out)++; (*out)++;
} }
if (hasNull) {
colDataAppendNULL(pOutputData, 0);
}
pOutput->numOfRows = 1; pOutput->numOfRows = 1;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }