diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index f6d2fdadaea0e05e5d45c98193e57f809f093d07..f985cc324d809cd0937e2d886dfff55c1f29b2e3 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -1268,7 +1268,7 @@ static bool validateMinuteRange(int8_t hour, int8_t minute, char sign) { } static bool validateTimestampDigits(const SValueNode* pVal) { - if (IS_INTEGER_TYPE(pVal->node.resType.type)) { + if (!IS_INTEGER_TYPE(pVal->node.resType.type)) { return false; } diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index d335b04ea474bb41e4d09c89b946866e8b919f30..a5154fac398cc2d0ebcf55c8ccbcfaa954559cbc 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -856,10 +856,13 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { int32_t type = GET_PARAM_TYPE(pInput); + bool tzPresent = (inputNum == 2) ? true : false; char* tz; int32_t tzLen; - tz = varDataVal(pInput[1].columnData->pData); - tzLen = varDataLen(pInput[1].columnData->pData); + if (tzPresent) { + tz = varDataVal(pInput[1].columnData->pData); + tzLen = varDataLen(pInput[1].columnData->pData); + } for (int32_t i = 0; i < pInput[0].numOfRows; ++i) { if (colDataIsNull_s(pInput[0].columnData, i)) {