enh:[TD-30998] Handling return value in sclvector.c
This commit is contained in:
parent
e0ffc8edcb
commit
a1fb874c22
|
@ -143,12 +143,24 @@ int32_t executeMakePointFunc(SColumnInfoData *pInputData[], int32_t iLeft, int32
|
||||||
getDoubleValueFn[1]= getVectorDoubleValueFn(pInputData[1]->info.type);
|
getDoubleValueFn[1]= getVectorDoubleValueFn(pInputData[1]->info.type);
|
||||||
|
|
||||||
unsigned char *output = NULL;
|
unsigned char *output = NULL;
|
||||||
code = doMakePointFunc(getDoubleValueFn[0](pInputData[0]->pData, iLeft), getDoubleValueFn[1](pInputData[1]->pData, iRight), &output);
|
double leftRes = 0;
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
double rightRes = 0;
|
||||||
|
code = getDoubleValueFn[0](pInputData[0]->pData, iLeft, &leftRes);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
code = getDoubleValueFn[1](pInputData[1]->pData, iRight, &rightRes);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
code = doMakePointFunc(leftRes, rightRes, &output);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
code = colDataSetVal(pOutputData, TMAX(iLeft, iRight), output, (output == NULL));
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
colDataSetVal(pOutputData, TMAX(iLeft, iRight), output, (output == NULL));
|
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
if (output) {
|
if (output) {
|
||||||
|
|
|
@ -29,43 +29,54 @@ typedef struct SSclVectorConvCtx {
|
||||||
int16_t outType;
|
int16_t outType;
|
||||||
} SSclVectorConvCtx;
|
} SSclVectorConvCtx;
|
||||||
|
|
||||||
typedef double (*_getDoubleValue_fn_t)(void *src, int32_t index);
|
typedef int32_t (*_getDoubleValue_fn_t)(void *src, int32_t index, double *out);
|
||||||
|
|
||||||
static FORCE_INLINE double getVectorDoubleValue_TINYINT(void *src, int32_t index) {
|
static FORCE_INLINE int32_t getVectorDoubleValue_TINYINT(void *src, int32_t index, double *out) {
|
||||||
return (double)*((int8_t *)src + index);
|
*out = (double)*((int8_t *)src + index);
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
static FORCE_INLINE double getVectorDoubleValue_UTINYINT(void *src, int32_t index) {
|
static FORCE_INLINE int32_t getVectorDoubleValue_UTINYINT(void *src, int32_t index, double *out) {
|
||||||
return (double)*((uint8_t *)src + index);
|
*out = (double)*((uint8_t *)src + index);
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
static FORCE_INLINE double getVectorDoubleValue_SMALLINT(void *src, int32_t index) {
|
static FORCE_INLINE int32_t getVectorDoubleValue_SMALLINT(void *src, int32_t index, double *out) {
|
||||||
return (double)*((int16_t *)src + index);
|
*out = (double)*((int16_t *)src + index);
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
static FORCE_INLINE double getVectorDoubleValue_USMALLINT(void *src, int32_t index) {
|
static FORCE_INLINE int32_t getVectorDoubleValue_USMALLINT(void *src, int32_t index, double *out) {
|
||||||
return (double)*((uint16_t *)src + index);
|
*out = (double)*((uint16_t *)src + index);
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
static FORCE_INLINE double getVectorDoubleValue_INT(void *src, int32_t index) {
|
static FORCE_INLINE int32_t getVectorDoubleValue_INT(void *src, int32_t index, double *out) {
|
||||||
return (double)*((int32_t *)src + index);
|
*out = (double)*((int32_t *)src + index);
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
static FORCE_INLINE double getVectorDoubleValue_UINT(void *src, int32_t index) {
|
static FORCE_INLINE int32_t getVectorDoubleValue_UINT(void *src, int32_t index, double *out) {
|
||||||
return (double)*((uint32_t *)src + index);
|
*out = (double)*((uint32_t *)src + index);
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
static FORCE_INLINE double getVectorDoubleValue_BIGINT(void *src, int32_t index) {
|
static FORCE_INLINE int32_t getVectorDoubleValue_BIGINT(void *src, int32_t index, double *out) {
|
||||||
return (double)*((int64_t *)src + index);
|
*out = (double)*((int64_t *)src + index);
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
static FORCE_INLINE double getVectorDoubleValue_UBIGINT(void *src, int32_t index) {
|
static FORCE_INLINE int32_t getVectorDoubleValue_UBIGINT(void *src, int32_t index, double *out) {
|
||||||
return (double)*((uint64_t *)src + index);
|
*out = (double)*((uint64_t *)src + index);
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
static FORCE_INLINE double getVectorDoubleValue_FLOAT(void *src, int32_t index) {
|
static FORCE_INLINE int32_t getVectorDoubleValue_FLOAT(void *src, int32_t index, double *out) {
|
||||||
return (double)*((float *)src + index);
|
*out = (double)*((float *)src + index);
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
static FORCE_INLINE double getVectorDoubleValue_DOUBLE(void *src, int32_t index) {
|
static FORCE_INLINE int32_t getVectorDoubleValue_DOUBLE(void *src, int32_t index, double *out) {
|
||||||
return (double)*((double *)src + index);
|
*out = (double)*((double *)src + index);
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
static FORCE_INLINE double getVectorDoubleValue_BOOL(void *src, int32_t index) {
|
static FORCE_INLINE int32_t getVectorDoubleValue_BOOL(void *src, int32_t index, double *out) {
|
||||||
return (double)*((bool *)src + index);
|
*out = (double)*((bool *)src + index);
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
double getVectorDoubleValue_JSON(void *src, int32_t index);
|
int32_t getVectorDoubleValue_JSON(void *src, int32_t index, double *out);
|
||||||
|
|
||||||
static FORCE_INLINE _getDoubleValue_fn_t getVectorDoubleValueFn(int32_t srcType) {
|
static FORCE_INLINE _getDoubleValue_fn_t getVectorDoubleValueFn(int32_t srcType) {
|
||||||
_getDoubleValue_fn_t p = NULL;
|
_getDoubleValue_fn_t p = NULL;
|
||||||
|
@ -103,7 +114,7 @@ static FORCE_INLINE _getDoubleValue_fn_t getVectorDoubleValueFn(int32_t srcType)
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef void (*_bufConverteFunc)(char *buf, SScalarParam *pOut, int32_t outType, int32_t *overflow);
|
typedef int32_t (*_bufConverteFunc)(char *buf, SScalarParam *pOut, int32_t outType, int32_t *overflow);
|
||||||
typedef int32_t (*_bin_scalar_fn_t)(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *output, int32_t order);
|
typedef int32_t (*_bin_scalar_fn_t)(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *output, int32_t order);
|
||||||
_bin_scalar_fn_t getBinScalarOperatorFn(int32_t binOperator);
|
_bin_scalar_fn_t getBinScalarOperatorFn(int32_t binOperator);
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,9 @@ static int32_t doScalarFunctionUnique(SScalarParam *pInput, int32_t inputNum, SS
|
||||||
colDataSetNULL(pOutputData, i);
|
colDataSetNULL(pOutputData, i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
double result = valFn(getValueFn(pInputData->pData, i));
|
double tmp = 0;
|
||||||
|
SCL_ERR_RET(getValueFn(pInputData->pData, i, &tmp));
|
||||||
|
double result = valFn(tmp);
|
||||||
if (isinf(result) || isnan(result)) {
|
if (isinf(result) || isnan(result)) {
|
||||||
colDataSetNULL(pOutputData, i);
|
colDataSetNULL(pOutputData, i);
|
||||||
} else {
|
} else {
|
||||||
|
@ -182,7 +184,11 @@ static int32_t doScalarFunctionUnique2(SScalarParam *pInput, int32_t inputNum, S
|
||||||
colDataSetNULL(pOutputData, i);
|
colDataSetNULL(pOutputData, i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
result = valFn(getValueFn[0](pInputData[0]->pData, i), getValueFn[1](pInputData[1]->pData, i));
|
double val1 = 0;
|
||||||
|
double val2 = 0;
|
||||||
|
SCL_ERR_RET(getValueFn[0](pInputData[0]->pData, i, &val1));
|
||||||
|
SCL_ERR_RET(getValueFn[1](pInputData[1]->pData, i, &val2));
|
||||||
|
result = valFn(val1, val2);
|
||||||
if (isinf(result) || isnan(result)) {
|
if (isinf(result) || isnan(result)) {
|
||||||
colDataSetNULL(pOutputData, i);
|
colDataSetNULL(pOutputData, i);
|
||||||
} else {
|
} else {
|
||||||
|
@ -198,8 +204,11 @@ static int32_t doScalarFunctionUnique2(SScalarParam *pInput, int32_t inputNum, S
|
||||||
colDataSetNULL(pOutputData, i);
|
colDataSetNULL(pOutputData, i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
double val1 = 0;
|
||||||
result = valFn(getValueFn[0](pInputData[0]->pData, 0), getValueFn[1](pInputData[1]->pData, i));
|
double val2 = 0;
|
||||||
|
SCL_ERR_RET(getValueFn[0](pInputData[0]->pData, 0, &val1));
|
||||||
|
SCL_ERR_RET(getValueFn[1](pInputData[1]->pData, i, &val2));
|
||||||
|
result = valFn(val1, val2);
|
||||||
if (isinf(result) || isnan(result)) {
|
if (isinf(result) || isnan(result)) {
|
||||||
colDataSetNULL(pOutputData, i);
|
colDataSetNULL(pOutputData, i);
|
||||||
continue;
|
continue;
|
||||||
|
@ -217,8 +226,11 @@ static int32_t doScalarFunctionUnique2(SScalarParam *pInput, int32_t inputNum, S
|
||||||
colDataSetNULL(pOutputData, i);
|
colDataSetNULL(pOutputData, i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
double val1 = 0;
|
||||||
result = valFn(getValueFn[0](pInputData[0]->pData, i), getValueFn[1](pInputData[1]->pData, 0));
|
double val2 = 0;
|
||||||
|
SCL_ERR_RET(getValueFn[0](pInputData[0]->pData, i, &val1));
|
||||||
|
SCL_ERR_RET(getValueFn[1](pInputData[1]->pData, 0, &val2));
|
||||||
|
result = valFn(val1, val2);
|
||||||
if (isinf(result) || isnan(result)) {
|
if (isinf(result) || isnan(result)) {
|
||||||
colDataSetNULL(pOutputData, i);
|
colDataSetNULL(pOutputData, i);
|
||||||
continue;
|
continue;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -80,7 +80,7 @@ void scltInitLogFile() {
|
||||||
|
|
||||||
tsAsyncLog = 0;
|
tsAsyncLog = 0;
|
||||||
qDebugFlag = 159;
|
qDebugFlag = 159;
|
||||||
strcpy(tsLogDir, TD_LOG_DIR_PATH);
|
(void)strcpy(tsLogDir, TD_LOG_DIR_PATH);
|
||||||
|
|
||||||
if (taosInitLog(defaultLogFileNamePrefix, maxLogFileNum) < 0) {
|
if (taosInitLog(defaultLogFileNamePrefix, maxLogFileNum) < 0) {
|
||||||
printf("failed to open log file in directory:%s\n", tsLogDir);
|
printf("failed to open log file in directory:%s\n", tsLogDir);
|
||||||
|
|
Loading…
Reference in New Issue