diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index c1cdcbcb0c2170e3475d62b5a98d4be945fa562b..0d0afd4011f97bdfb773b6ed04d87f9dcbd2e1ba 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -479,7 +479,7 @@ int32_t stubCheckAndGetResultType(SFunctionNode* pFunc) { int32_t paraType = pParam->node.resType.type; int32_t resType = 0; - if (IS_SIGNED_NUMERIC_TYPE(paraType)) { + if (IS_SIGNED_NUMERIC_TYPE(paraType) || paraType == TSDB_DATA_TYPE_BOOL) { resType = TSDB_DATA_TYPE_BIGINT; } else if (IS_UNSIGNED_NUMERIC_TYPE(paraType)) { resType = TSDB_DATA_TYPE_UBIGINT; diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index bad40422c8d1f8157442727b256eadfcc3a95aea..53b15a82af3da105947cf0b1f64610066b69d368 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -138,8 +138,8 @@ int32_t sumFunction(SqlFunctionCtx *pCtx) { int32_t start = pInput->startRowIndex; int32_t numOfRows = pInput->numOfRows; - if (IS_SIGNED_NUMERIC_TYPE(type)) { - if (type == TSDB_DATA_TYPE_TINYINT) { + if (IS_SIGNED_NUMERIC_TYPE(type) || type == TSDB_DATA_TYPE_BOOL) { + if (type == TSDB_DATA_TYPE_TINYINT || type == TSDB_DATA_TYPE_BOOL) { LIST_ADD_N(pSumRes->isum, pCol, start, numOfRows, int8_t, numOfElem); } else if (type == TSDB_DATA_TYPE_SMALLINT) { LIST_ADD_N(pSumRes->isum, pCol, start, numOfRows, int16_t, numOfElem);