diff --git a/include/common/tcommon.h b/include/common/tcommon.h index 51eabb7d617ed42ab6ad520bb6da69d178ae92bb..988bf3f4e83619b524a3938772358091009d5733 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -198,8 +198,8 @@ typedef struct SGroupbyExpr { } SGroupbyExpr; enum { - FUNC_PARAM_TYPE_VALUE = 0, - FUNC_PARAM_TYPE_COLUMN, + FUNC_PARAM_TYPE_VALUE = 0x1, + FUNC_PARAM_TYPE_COLUMN= 0x2, }; typedef struct SFunctParam { diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index d97b3183f226d5f8ae709de9010ba8c3d0a97dc7..8e4e33c9973d257ea1e510c89d96517b6896f8ed 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1258,8 +1258,8 @@ static void doSetInputDataBlock(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx, ASSERT(pCtx[i].input.pData[j] != NULL); } } - // setBlockStatisInfo(&pCtx[i], pBlock, pOperator->pExpr[i].base.pColumns); + // setBlockStatisInfo(&pCtx[i], pBlock, pOperator->pExpr[i].base.pColumns); // uint32_t flag = pOperator->pExpr[i].base.pParam[0].pCol->flag; // if (TSDB_COL_IS_NORMAL_COL(flag) /*|| (pCtx[i].functionId == FUNCTION_BLKINFO) || // (TSDB_COL_IS_TAG(flag) && pOperator->pRuntimeEnv->scanFlag == MERGE_STAGE)*/) { @@ -8771,8 +8771,8 @@ SExprInfo* createExprInfo(SNodeList* pNodeList, SNodeList* pGroupKeys, int32_t* pExp->pExpr->_optrRoot.pRootNode = pTargetNode->pExpr; - pExp->base.pParam[0].type = FUNC_PARAM_TYPE_COLUMN; - pExp->base.pParam[0].pCol = createColumn(pTargetNode->dataBlockId, pTargetNode->slotId, pType); +// pExp->base.pParam[0].type = FUNC_PARAM_TYPE_COLUMN; +// pExp->base.pParam[0].pCol = createColumn(pTargetNode->dataBlockId, pTargetNode->slotId, pType); } else { ASSERT(0); } diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index f22f9a5c3c06c799160ef6ece32e3d0ca9e45513..33be65832cd843f743991f160223d754483afb87 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -720,7 +720,7 @@ void vectorMathRemainder(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam double lx = getVectorDoubleValueFnLeft(pLeftCol->pData, i); double rx = getVectorDoubleValueFnRight(pRightCol->pData, i); - if (compareDoubleVal(&zero, &rx)) { + if (isnan(lx) || isinf(lx) || isnan(rx) || isinf(rx)) { colDataAppend(pOutputCol, i, NULL, true); continue; } @@ -729,7 +729,7 @@ void vectorMathRemainder(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam } } else if (pLeft->numOfRows == 1) { double lx = getVectorDoubleValueFnLeft(pLeftCol->pData, 0); - if (colDataIsNull_f(pLeftCol->nullbitmap, 0)) { // Set pLeft->numOfRows NULL value + if (colDataIsNull_f(pLeftCol->nullbitmap, 0) || isnan(lx) || isinf(lx)) { // Set pLeft->numOfRows NULL value // TODO set numOfRows NULL value } else { for (; i >= 0 && i < pRight->numOfRows; i += step, output += 1) { @@ -739,7 +739,7 @@ void vectorMathRemainder(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam } double rx = getVectorDoubleValueFnRight(pRightCol->pData, i); - if (compareDoubleVal(&zero, &rx)) { + if (isnan(rx) || isinf(rx) || FLT_EQUAL(rx, 0)) { colDataAppend(pOutputCol, i, NULL, true); continue; } @@ -749,17 +749,17 @@ void vectorMathRemainder(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam } } else if (pRight->numOfRows == 1) { double rx = getVectorDoubleValueFnRight(pRightCol->pData, 0); - if (colDataIsNull_f(pRightCol->nullbitmap, 0)) { // Set pLeft->numOfRows NULL value + if (colDataIsNull_f(pRightCol->nullbitmap, 0) || FLT_EQUAL(rx, 0)) { // Set pLeft->numOfRows NULL value // TODO set numOfRows NULL value } else { for (; i >= 0 && i < pLeft->numOfRows; i += step, output += 1) { - if (colDataIsNull_f(pRightCol->nullbitmap, i)) { + if (colDataIsNull_f(pLeftCol->nullbitmap, i)) { colDataAppend(pOutputCol, i, NULL, true); continue; } - double lx = getVectorDoubleValueFnLeft(pRightCol->pData, i); - if (compareDoubleVal(&zero, &lx)) { + double lx = getVectorDoubleValueFnLeft(pLeftCol->pData, i); + if (isnan(lx) || isinf(lx)) { colDataAppend(pOutputCol, i, NULL, true); continue; } diff --git a/source/util/src/tcompare.c b/source/util/src/tcompare.c index c98f6eb9be326317dd35dd678fed724ec30546ca..7f9a3ff5939e30384c47dff802fe23bb12066e74 100644 --- a/source/util/src/tcompare.c +++ b/source/util/src/tcompare.c @@ -173,6 +173,7 @@ int32_t compareDoubleVal(const void *pLeft, const void *pRight) { if (isnan(p2)) { return 1; } + if (FLT_EQUAL(p1, p2)) { return 0; }