enh:[TD-31529] Remove ASSERT in libs/scalar.

This commit is contained in:
sima 2024-08-19 16:52:30 +08:00
parent ae16b3b98f
commit 50672cd1a8
10 changed files with 281 additions and 134 deletions

View File

@ -604,6 +604,9 @@ int32_t taosGetErrSize();
#define TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x0732)
#define TSDB_CODE_QRY_INVALID_JOIN_CONDITION TAOS_DEF_ERROR_CODE(0, 0x0733)
#define TSDB_CODE_QRY_FILTER_NOT_SUPPORT_TYPE TAOS_DEF_ERROR_CODE(0, 0x0734)
#define TSDB_CODE_QRY_FILTER_WRONG_OPTR_TYPE TAOS_DEF_ERROR_CODE(0, 0x0735)
#define TSDB_CODE_QRY_FILTER_RANGE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0736)
#define TSDB_CODE_QRY_FILTER_INVALID_TYPE TAOS_DEF_ERROR_CODE(0, 0x0737)
// grant
#define TSDB_CODE_GRANT_EXPIRED TAOS_DEF_ERROR_CODE(0, 0x0800)

View File

@ -131,12 +131,12 @@ _exit:
int32_t executeMakePointFunc(SColumnInfoData *pInputData[], int32_t iLeft, int32_t iRight,
SColumnInfoData *pOutputData) {
int32_t code = TSDB_CODE_FAILED;
unsigned char *output = NULL;
_getDoubleValue_fn_t getDoubleValueFn[2];
getDoubleValueFn[0] = getVectorDoubleValueFn(pInputData[0]->info.type);
getDoubleValueFn[1] = getVectorDoubleValueFn(pInputData[1]->info.type);
TAOS_CHECK_GOTO(getVectorDoubleValueFn(pInputData[0]->info.type, &getDoubleValueFn[0]), NULL, _exit);
TAOS_CHECK_GOTO(getVectorDoubleValueFn(pInputData[1]->info.type, &getDoubleValueFn[1]), NULL, _exit);
unsigned char *output = NULL;
double leftRes = 0;
double rightRes = 0;

View File

@ -78,40 +78,41 @@ static FORCE_INLINE int32_t getVectorDoubleValue_BOOL(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) {
_getDoubleValue_fn_t p = NULL;
static FORCE_INLINE int32_t getVectorDoubleValueFn(int32_t srcType, _getDoubleValue_fn_t *p) {
*p = NULL;
if (srcType == TSDB_DATA_TYPE_TINYINT) {
p = getVectorDoubleValue_TINYINT;
*p = getVectorDoubleValue_TINYINT;
} else if (srcType == TSDB_DATA_TYPE_UTINYINT) {
p = getVectorDoubleValue_UTINYINT;
*p = getVectorDoubleValue_UTINYINT;
} else if (srcType == TSDB_DATA_TYPE_SMALLINT) {
p = getVectorDoubleValue_SMALLINT;
*p = getVectorDoubleValue_SMALLINT;
} else if (srcType == TSDB_DATA_TYPE_USMALLINT) {
p = getVectorDoubleValue_USMALLINT;
*p = getVectorDoubleValue_USMALLINT;
} else if (srcType == TSDB_DATA_TYPE_INT) {
p = getVectorDoubleValue_INT;
*p = getVectorDoubleValue_INT;
} else if (srcType == TSDB_DATA_TYPE_UINT) {
p = getVectorDoubleValue_UINT;
*p = getVectorDoubleValue_UINT;
} else if (srcType == TSDB_DATA_TYPE_BIGINT) {
p = getVectorDoubleValue_BIGINT;
*p = getVectorDoubleValue_BIGINT;
} else if (srcType == TSDB_DATA_TYPE_UBIGINT) {
p = getVectorDoubleValue_UBIGINT;
*p = getVectorDoubleValue_UBIGINT;
} else if (srcType == TSDB_DATA_TYPE_FLOAT) {
p = getVectorDoubleValue_FLOAT;
*p = getVectorDoubleValue_FLOAT;
} else if (srcType == TSDB_DATA_TYPE_DOUBLE) {
p = getVectorDoubleValue_DOUBLE;
*p = getVectorDoubleValue_DOUBLE;
} else if (srcType == TSDB_DATA_TYPE_TIMESTAMP) {
p = getVectorDoubleValue_BIGINT;
*p = getVectorDoubleValue_BIGINT;
} else if (srcType == TSDB_DATA_TYPE_JSON) {
p = getVectorDoubleValue_JSON;
*p = getVectorDoubleValue_JSON;
} else if (srcType == TSDB_DATA_TYPE_BOOL) {
p = getVectorDoubleValue_BOOL;
*p = getVectorDoubleValue_BOOL;
} else if (srcType == TSDB_DATA_TYPE_NULL) {
p = NULL;
*p = NULL;
} else {
ASSERT(0);
*p = NULL;
return TSDB_CODE_SCALAR_CONVERT_ERROR;
}
return p;
return TSDB_CODE_SUCCESS;
}
typedef int32_t (*_bufConverteFunc)(char *buf, SScalarParam *pOut, int32_t outType, int32_t *overflow);

View File

@ -92,7 +92,9 @@ rangeCompFunc gRangeCompare[] = {filterRangeCompee, filterRangeCompei, filterRan
int8_t filterGetRangeCompFuncFromOptrs(uint8_t optr, uint8_t optr2) {
if (optr2) {
ASSERT(optr2 == OP_TYPE_LOWER_THAN || optr2 == OP_TYPE_LOWER_EQUAL);
if (optr2 != OP_TYPE_LOWER_THAN && optr2 != OP_TYPE_LOWER_EQUAL) {
return -1;
}
if (optr == OP_TYPE_GREATER_THAN) {
if (optr2 == OP_TYPE_LOWER_THAN) {
@ -763,7 +765,10 @@ int32_t filterAddRangeCtx(void *dst, void *src, int32_t optr) {
SFilterRangeCtx *dctx = (SFilterRangeCtx *)dst;
SFilterRangeCtx *sctx = (SFilterRangeCtx *)src;
ASSERT(optr == LOGIC_COND_TYPE_OR);
if (optr != LOGIC_COND_TYPE_OR) {
fltError("filterAddRangeCtx get invalid optr:%d", optr);
return TSDB_CODE_QRY_FILTER_WRONG_OPTR_TYPE;
}
if (sctx->rs == NULL) {
return TSDB_CODE_SUCCESS;
@ -1204,7 +1209,10 @@ int32_t filterAddUnitImpl(SFilterInfo *info, uint8_t optr, SFilterFieldId *left,
if (u->right.type == FLD_TYPE_VALUE) {
SFilterField *val = FILTER_UNIT_RIGHT_FIELD(info, u);
ASSERT(FILTER_GET_FLAG(val->flag, FLD_TYPE_VALUE));
if (!FILTER_GET_FLAG(val->flag, FLD_TYPE_VALUE)) {
fltError("filterAddUnitImpl get invalid flag : %d in val", val->flag);
return TSDB_CODE_APP_ERROR;
}
} else {
int32_t paramNum = scalarGetOperatorParamNum(optr);
if (1 != paramNum) {
@ -1214,7 +1222,10 @@ int32_t filterAddUnitImpl(SFilterInfo *info, uint8_t optr, SFilterFieldId *left,
}
SFilterField *col = FILTER_UNIT_LEFT_FIELD(info, u);
ASSERT(FILTER_GET_FLAG(col->flag, FLD_TYPE_COLUMN));
if (!FILTER_GET_FLAG(col->flag, FLD_TYPE_COLUMN)) {
fltError("filterAddUnitImpl get invalid flag : %d in col", col->flag);
return TSDB_CODE_APP_ERROR;
}
info->units[info->unitNum].compare.type = FILTER_GET_COL_FIELD_TYPE(col);
info->units[info->unitNum].compare.precision = FILTER_GET_COL_FIELD_PRECISION(col);
@ -1398,29 +1409,48 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan
if (optr == LOGIC_COND_TYPE_AND) {
if (ctx->isnull) {
ASSERT(ctx->notnull == false && ctx->isrange == false);
if (ctx->notnull || ctx->isrange) {
fltError("filterAddGroupUnitFromCtx get invalid ctx : isnull %d, notnull %d, isrange %d",
ctx->isnull, ctx->notnull, ctx->isrange);
FLT_ERR_RET(TSDB_CODE_QRY_FILTER_RANGE_ERROR);
}
FLT_ERR_RET(filterAddUnit(dst, OP_TYPE_IS_NULL, &left, NULL, &uidx));
FLT_ERR_RET(filterAddUnitToGroup(g, uidx));
return TSDB_CODE_SUCCESS;
}
if (ctx->notnull) {
ASSERT(ctx->isnull == false && ctx->isrange == false);
if (ctx->isnull || ctx->isrange) {
fltError("filterAddGroupUnitFromCtx get invalid ctx : isnull %d, notnull %d, isrange %d",
ctx->isnull, ctx->notnull, ctx->isrange);
FLT_ERR_RET(TSDB_CODE_QRY_FILTER_RANGE_ERROR);
}
FLT_ERR_RET(filterAddUnit(dst, OP_TYPE_IS_NOT_NULL, &left, NULL, &uidx));
FLT_ERR_RET(filterAddUnitToGroup(g, uidx));
return TSDB_CODE_SUCCESS;
}
if (!ctx->isrange) {
ASSERT(ctx->isnull || ctx->notnull);
if (!ctx->isnull && !ctx->notnull) {
fltError("filterAddGroupUnitFromCtx get invalid ctx : isnull %d, notnull %d, isrange %d",
ctx->isnull, ctx->notnull, ctx->isrange);
FLT_ERR_RET(TSDB_CODE_QRY_FILTER_RANGE_ERROR);
}
return TSDB_CODE_SUCCESS;
}
ASSERT(ctx->rs && ctx->rs->next == NULL);
if (!ctx->rs || ctx->rs->next != NULL) {
fltError("filterAddGroupUnitFromCtx get invalid range node with rs:%p", ctx->rs);
FLT_ERR_RET(TSDB_CODE_QRY_FILTER_RANGE_ERROR);
}
SFilterRange *ra = &ctx->rs->ra;
ASSERT(!((FILTER_GET_FLAG(ra->sflag, RANGE_FLG_NULL)) && (FILTER_GET_FLAG(ra->eflag, RANGE_FLG_NULL))));
if (((FILTER_GET_FLAG(ra->sflag, RANGE_FLG_NULL)) && (FILTER_GET_FLAG(ra->eflag, RANGE_FLG_NULL)))) {
fltError("filterAddGroupUnitFromCtx get invalid range with sflag:%d, eflag:%d",
FILTER_GET_FLAG(ra->sflag, RANGE_FLG_NULL), FILTER_GET_FLAG(ra->eflag, RANGE_FLG_NULL));
FLT_ERR_RET(TSDB_CODE_QRY_FILTER_RANGE_ERROR);
}
if ((!FILTER_GET_FLAG(ra->sflag, RANGE_FLG_NULL)) && (!FILTER_GET_FLAG(ra->eflag, RANGE_FLG_NULL))) {
__compar_fn_t func = getComparFunc(type, 0);
@ -1489,7 +1519,11 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan
SFilterGroup ng = {0};
g = &ng;
ASSERT(ctx->isnull || ctx->notnull || ctx->isrange);
if (!ctx->isnull && !ctx->notnull && !ctx->isrange) {
fltError("filterAddGroupUnitFromCtx get invalid ctx : isnull %d, notnull %d, isrange %d",
ctx->isnull, ctx->notnull, ctx->isrange);
FLT_ERR_RET(TSDB_CODE_APP_ERROR);
}
if (ctx->isnull) {
FLT_ERR_RET(filterAddUnit(dst, OP_TYPE_IS_NULL, &left, NULL, &uidx));
@ -1500,7 +1534,11 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan
}
if (ctx->notnull) {
ASSERT(!ctx->isrange);
if (ctx->isrange) {
fltError("filterAddGroupUnitFromCtx get invalid ctx : isnull %d, notnull %d, isrange %d",
ctx->isnull, ctx->notnull, ctx->isrange);
FLT_ERR_RET(TSDB_CODE_QRY_FILTER_RANGE_ERROR);
}
(void)memset(g, 0, sizeof(*g));
FLT_ERR_RET(filterAddUnit(dst, OP_TYPE_IS_NOT_NULL, &left, NULL, &uidx));
@ -1511,7 +1549,11 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan
}
if (!ctx->isrange) {
ASSERT(ctx->isnull || ctx->notnull);
if (!ctx->isnull && !ctx->notnull) {
fltError("filterAddGroupUnitFromCtx get invalid ctx : isnull %d, notnull %d, isrange %d",
ctx->isnull, ctx->notnull, ctx->isrange);
FLT_ERR_RET(TSDB_CODE_QRY_FILTER_RANGE_ERROR);
}
g->unitNum = 0;
return TSDB_CODE_SUCCESS;
}
@ -1586,7 +1628,10 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan
FLT_ERR_RET(filterAddUnitToGroup(g, uidx));
}
ASSERT(g->unitNum > 0);
if (g->unitNum <= 0) {
fltError("filterAddGroupUnitFromCtx get invalid filter group unit num %d", g->unitNum);
FLT_ERR_RET(TSDB_CODE_QRY_FILTER_RANGE_ERROR);
}
if (NULL == taosArrayPush(res,g)) {
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
@ -2066,7 +2111,10 @@ void filterFreeInfo(SFilterInfo *info) {
}
int32_t filterHandleValueExtInfo(SFilterUnit *unit, char extInfo) {
ASSERT(extInfo > 0 || extInfo < 0);
if (extInfo == 0) {
fltError("filterHandleValueExtInfo get invalid extInfo : %d", extInfo);
return TSDB_CODE_APP_ERROR;
}
uint8_t optr = FILTER_UNIT_OPTR(unit);
switch (optr) {
@ -2093,13 +2141,20 @@ int32_t fltInitValFieldData(SFilterInfo *info) {
for (uint32_t i = 0; i < info->unitNum; ++i) {
SFilterUnit *unit = &info->units[i];
if (unit->right.type != FLD_TYPE_VALUE) {
ASSERT(unit->compare.optr == FILTER_DUMMY_EMPTY_OPTR || scalarGetOperatorParamNum(unit->compare.optr) == 1);
if (unit->compare.optr != FILTER_DUMMY_EMPTY_OPTR && scalarGetOperatorParamNum(unit->compare.optr) != 1) {
fltError("filterInitValFieldData get invalid operator param num : %d and invalid compare optr %d",
scalarGetOperatorParamNum(unit->compare.optr), unit->compare.optr);
return TSDB_CODE_APP_ERROR;
}
continue;
}
SFilterField *right = FILTER_UNIT_RIGHT_FIELD(info, unit);
ASSERT(FILTER_GET_FLAG(right->flag, FLD_TYPE_VALUE));
if (!FILTER_GET_FLAG(right->flag, FLD_TYPE_VALUE)) {
fltError("filterInitValFieldData get invalid field flag : %d", right->flag);
return TSDB_CODE_APP_ERROR;
}
uint32_t type = FILTER_UNIT_DATA_TYPE(unit);
int8_t precision = FILTER_UNIT_DATA_PRECISION(unit);
@ -2107,7 +2162,10 @@ int32_t fltInitValFieldData(SFilterInfo *info) {
SValueNode *var = (SValueNode *)fi->desc;
if (var == NULL) {
ASSERT(fi->data != NULL);
if (!fi->data) {
fltError("filterInitValFieldData get invalid field data : NULL");
return TSDB_CODE_APP_ERROR;
}
continue;
}
@ -2257,7 +2315,10 @@ int32_t filterAddUnitRange(SFilterInfo *info, SFilterUnit *u, SFilterRangeCtx *c
FILTER_SET_FLAG(ra.sflag, RANGE_FLG_NULL);
break;
case OP_TYPE_NOT_EQUAL:
ASSERT(type == TSDB_DATA_TYPE_BOOL);
if (type != TSDB_DATA_TYPE_BOOL) {
fltError("filterAddUnitRange get invalid type : %d", type);
return TSDB_CODE_QRY_FILTER_INVALID_TYPE;
}
if (GET_INT8_VAL(val)) {
SIMPLE_COPY_VALUES(&ra.s, &tmp);
SIMPLE_COPY_VALUES(&ra.e, &tmp);
@ -2273,7 +2334,7 @@ int32_t filterAddUnitRange(SFilterInfo *info, SFilterUnit *u, SFilterRangeCtx *c
break;
default:
fltError("unsupported operator type");
return TSDB_CODE_APP_ERROR;
return TSDB_CODE_QRY_FILTER_NOT_SUPPORT_TYPE;
}
FLT_ERR_RET(filterAddRange(ctx, &ra, optr));
@ -2547,8 +2608,11 @@ int32_t filterMergeTwoGroupsImpl(SFilterInfo *info, SFilterRangeCtx **ctx, int32
FLT_ERR_RET(filterReuseRangeCtx(*ctx, type, 0));
}
ASSERT(gRes2->colInfo[cidx].type == RANGE_TYPE_MR_CTX);
ASSERT(gRes1->colInfo[cidx].type == RANGE_TYPE_MR_CTX);
if (gRes2->colInfo[cidx].type != RANGE_TYPE_MR_CTX || gRes1->colInfo[cidx].type != RANGE_TYPE_MR_CTX) {
fltError("filterMergeTwoGroupsImpl get invalid col type : %d and %d",
gRes2->colInfo[cidx].type, gRes1->colInfo[cidx].type);
return TSDB_CODE_QRY_FILTER_NOT_SUPPORT_TYPE;
}
FLT_ERR_RET(filterCopyRangeCtx(*ctx, gRes2->colInfo[cidx].info));
FLT_ERR_RET(filterSourceRangeFromCtx(*ctx, gRes1->colInfo[cidx].info, optr, empty, all));
@ -2588,7 +2652,10 @@ int32_t filterMergeTwoGroups(SFilterInfo *info, SFilterGroupCtx **gRes1, SFilter
continue;
}
ASSERT(idx1 == idx2);
if (idx1 != idx2) {
fltError("filterMergeTwoGroups get invalid idx : %d and %d", idx1, idx2);
FLT_ERR_JRET(TSDB_CODE_APP_ERROR);
}
++merNum;
@ -2644,16 +2711,19 @@ int32_t filterMergeTwoGroups(SFilterInfo *info, SFilterGroupCtx **gRes1, SFilter
}
}
ASSERT(merNum > 0);
SFilterColInfo *colInfo = NULL;
ASSERT(merNum == equal1 || merNum == equal2);
if (merNum == 0 || (equal1 != merNum && equal2 != merNum)) {
fltError("filterMergeTwoGroups get invalid merge num : %d, equal1 : %d, equal2 : %d", merNum, equal1, equal2);
FLT_ERR_JRET(TSDB_CODE_APP_ERROR);
}
filterFreeGroupCtx(*gRes2);
*gRes2 = NULL;
ASSERT(colCtxs && taosArrayGetSize(colCtxs) > 0);
if (!colCtxs || taosArrayGetSize(colCtxs) <= 0) {
fltError("filterMergeTwoGroups get invalid colCtxs with size %zu", taosArrayGetSize(colCtxs));
FLT_ERR_JRET(TSDB_CODE_APP_ERROR);
}
SFilterColInfo *colInfo = NULL;
int32_t ctxSize = (int32_t)taosArrayGetSize(colCtxs);
SFilterColCtx *pctx = NULL;
@ -2713,7 +2783,10 @@ int32_t filterMergeGroups(SFilterInfo *info, SFilterGroupCtx **gRes, int32_t *gR
if (pColNum > 0) {
for (int32_t m = 0; m <= pEnd; ++m) {
for (int32_t n = cStart; n <= cEnd; ++n) {
ASSERT(m < n);
if (m >= n) {
fltError("filterMergeGroups get invalid m : %d and n : %d", m, n);
FLT_ERR_JRET(TSDB_CODE_APP_ERROR);
}
FLT_ERR_JRET(filterMergeTwoGroups(info, &gRes[m], &gRes[n], &all));
FLT_CHK_JMP(all);
@ -2734,7 +2807,10 @@ int32_t filterMergeGroups(SFilterInfo *info, SFilterGroupCtx **gRes, int32_t *gR
for (int32_t m = cStart; m < cEnd; ++m) {
for (int32_t n = m + 1; n <= cEnd; ++n) {
ASSERT(m < n);
if (m >= n) {
fltError("filterMergeGroups get invalid m : %d and n : %d", m, n);
FLT_ERR_JRET(TSDB_CODE_APP_ERROR);
}
FLT_ERR_JRET(filterMergeTwoGroups(info, &gRes[m], &gRes[n], &all));
FLT_CHK_JMP(all);
@ -2844,7 +2920,10 @@ int32_t filterRewrite(SFilterInfo *info, SFilterGroupCtx **gRes, int32_t gResNum
for (uint32_t m = 0; m < res->colNum; ++m) {
colInfo = &res->colInfo[res->colIdx[m]];
if (FILTER_NO_MERGE_DATA_TYPE(colInfo->dataType)) {
ASSERT(colInfo->type == RANGE_TYPE_UNIT);
if (colInfo->type != RANGE_TYPE_UNIT) {
fltError("filterRewrite get invalid col type : %d", colInfo->type);
FLT_ERR_JRET(TSDB_CODE_QRY_FILTER_INVALID_TYPE);
}
int32_t usize = (int32_t)taosArrayGetSize((SArray *)colInfo->info);
for (int32_t n = 0; n < usize; ++n) {
@ -2859,7 +2938,10 @@ int32_t filterRewrite(SFilterInfo *info, SFilterGroupCtx **gRes, int32_t gResNum
continue;
}
ASSERT(colInfo->type == RANGE_TYPE_MR_CTX);
if (colInfo->type != RANGE_TYPE_MR_CTX) {
fltError("filterRewrite get invalid col type : %d", colInfo->type);
FLT_ERR_JRET(TSDB_CODE_QRY_FILTER_INVALID_TYPE);
}
FLT_ERR_JRET(filterAddGroupUnitFromCtx(info, &oinfo, colInfo->info, res->colIdx[m], &ng, optr, group));
}
@ -2905,7 +2987,10 @@ int32_t filterGenerateColRange(SFilterInfo *info, SFilterGroupCtx **gRes, int32_
continue;
}
ASSERT(idxNum[i] == gResNum);
if (idxNum[i] != gResNum) {
fltError("filterGenerateColRange get invalid idxNum : %d and gResNum : %d", idxNum[i], gResNum);
FLT_ERR_JRET(TSDB_CODE_APP_ERROR);
}
if (idxs == NULL) {
idxs = taosMemoryCalloc(info->fields[FLD_TYPE_COLUMN].num, sizeof(*idxs));
@ -2936,7 +3021,10 @@ int32_t filterGenerateColRange(SFilterInfo *info, SFilterGroupCtx **gRes, int32_
continue;
}
ASSERT(res->colIdx[n] == idxs[m]);
if (res->colIdx[n] != idxs[m]) {
fltError("filterGenerateColRange get invalid colIdx : %d and idxs : %d", res->colIdx[n], idxs[m]);
SCL_ERR_JRET(TSDB_CODE_APP_ERROR);
}
SFilterColInfo *colInfo = &res->colInfo[res->colIdx[n]];
if (info->colRange[m] == NULL) {
@ -2945,7 +3033,10 @@ int32_t filterGenerateColRange(SFilterInfo *info, SFilterGroupCtx **gRes, int32_
info->colRange[m]->colId = FILTER_GET_COL_FIELD_ID(fi);
}
ASSERT(colInfo->type == RANGE_TYPE_MR_CTX);
if (colInfo->type != RANGE_TYPE_MR_CTX) {
fltError("filterGenerateColRange get invalid col type : %d", colInfo->type);
FLT_ERR_JRET(TSDB_CODE_QRY_FILTER_INVALID_TYPE);
}
bool all = false;
FLT_ERR_JRET(filterSourceRangeFromCtx(info->colRange[m], colInfo->info, LOGIC_COND_TYPE_OR, NULL, &all));
@ -3195,7 +3286,10 @@ int32_t filterRmUnitByRange(SFilterInfo *info, SColumnDataAgg *pDataStatis, int3
unitIdx = pGroupIdx;
--info->blkGroupNum;
ASSERT(empty || all);
if (!empty && !all) {
fltError("filterRmUnitByRange get invalid empty and all : %d and %d", empty, all);
FLT_ERR_RET(TSDB_CODE_APP_ERROR);
}
if (empty) {
FILTER_SET_FLAG(info->blkFlag, FI_STATUS_BLK_EMPTY);
@ -3303,7 +3397,10 @@ int32_t filterExecuteBasedOnStatis(SFilterInfo *info, int32_t numOfRows, SColumn
goto _return;
}
ASSERT(info->unitNum > 1);
if (info->unitNum <= 1) {
fltError("filterExecuteBasedOnStatis get invalid unit num : %d", info->unitNum);
FLT_ERR_JRET(TSDB_CODE_APP_ERROR);
}
*all = filterExecuteBasedOnStatisImpl(info, numOfRows, p, statis, numOfCols);
goto _return;
@ -5161,7 +5258,6 @@ int32_t filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData **p,
return TSDB_CODE_SUCCESS;
}
ASSERT(false == info->scalarMode);
*p = output.columnData;
output.numOfRows = pSrc->info.rows;

View File

@ -297,7 +297,8 @@ static int32_t doScalarFunctionUnique(SScalarParam *pInput, int32_t inputNum, SS
SColumnInfoData *pInputData = pInput->columnData;
SColumnInfoData *pOutputData = pOutput->columnData;
_getDoubleValue_fn_t getValueFn = getVectorDoubleValueFn(type);
_getDoubleValue_fn_t getValueFn;
SCL_ERR_RET(getVectorDoubleValueFn(type, &getValueFn));
double *out = (double *)pOutputData->pData;
@ -328,7 +329,7 @@ static int32_t doScalarFunctionUnique2(SScalarParam *pInput, int32_t inputNum, S
for (int32_t i = 0; i < inputNum; ++i) {
pInputData[i] = pInput[i].columnData;
getValueFn[i] = getVectorDoubleValueFn(GET_PARAM_TYPE(&pInput[i]));
SCL_ERR_RET(getVectorDoubleValueFn(GET_PARAM_TYPE(&pInput[i]), &getValueFn[i]));
}
double *out = (double *)pOutputData->pData;
@ -2918,7 +2919,7 @@ static int32_t doScalarFunction2(SScalarParam *pInput, int32_t inputNum, SScalar
for (int32_t i = 0; i < inputNum; ++i) {
pInputData[i] = pInput[i].columnData;
getValueFn[i] = getVectorDoubleValueFn(GET_PARAM_TYPE(&pInput[i]));
SCL_ERR_RET(getVectorDoubleValueFn(GET_PARAM_TYPE(&pInput[i]), &getValueFn[i]));
}
bool hasNullType = (IS_NULL_TYPE(GET_PARAM_TYPE(&pInput[0])) || IS_NULL_TYPE(GET_PARAM_TYPE(&pInput[1])));

View File

@ -43,7 +43,7 @@ bool noConvertBeforeCompare(int32_t leftType, int32_t rightType, int32_t optr) {
(optr >= OP_TYPE_GREATER_THAN && optr <= OP_TYPE_NOT_EQUAL);
}
void convertNumberToNumber(const void *inData, void *outData, int8_t inType, int8_t outType) {
int32_t convertNumberToNumber(const void *inData, void *outData, int8_t inType, int8_t outType) {
switch (outType) {
case TSDB_DATA_TYPE_BOOL: {
GET_TYPED_DATA(*((bool *)outData), bool, inType, inData);
@ -91,9 +91,10 @@ void convertNumberToNumber(const void *inData, void *outData, int8_t inType, int
break;
}
default: {
ASSERT(0);
return TSDB_CODE_SCALAR_CONVERT_ERROR;
}
}
return TSDB_CODE_SUCCESS;
}
int32_t convertNcharToDouble(const void *inData, void *outData) {
@ -180,7 +181,10 @@ int32_t getVectorBigintValue_BOOL(void *src, int32_t index, int64_t *res) {
}
int32_t getVectorBigintValue_JSON(void *src, int32_t index, int64_t *res) {
ASSERT(!colDataIsNull_var(((SColumnInfoData *)src), index));
if (colDataIsNull_var(((SColumnInfoData *)src), index)) {
sclError("getVectorBigintValue_JSON get json data null with index %d", index);
SCL_ERR_RET(TSDB_CODE_SCALAR_CONVERT_ERROR);
}
char *data = colDataGetVarData((SColumnInfoData *)src, index);
double out = 0;
if (*data == TSDB_DATA_TYPE_NULL) {
@ -192,46 +196,47 @@ int32_t getVectorBigintValue_JSON(void *src, int32_t index, int64_t *res) {
*res = 0;
SCL_ERR_RET(TSDB_CODE_QRY_JSON_NOT_SUPPORT_ERROR);
} else {
convertNumberToNumber(data + CHAR_BYTES, &out, *data, TSDB_DATA_TYPE_DOUBLE);
SCL_ERR_RET(convertNumberToNumber(data + CHAR_BYTES, &out, *data, TSDB_DATA_TYPE_DOUBLE));
}
*res = (int64_t)out;
SCL_RET(TSDB_CODE_SUCCESS);
}
_getBigintValue_fn_t getVectorBigintValueFn(int32_t srcType) {
_getBigintValue_fn_t p = NULL;
int32_t getVectorBigintValueFn(int32_t srcType, _getBigintValue_fn_t *p) {
*p = NULL;
if (srcType == TSDB_DATA_TYPE_TINYINT) {
p = getVectorBigintValue_TINYINT;
*p = getVectorBigintValue_TINYINT;
} else if (srcType == TSDB_DATA_TYPE_UTINYINT) {
p = getVectorBigintValue_UTINYINT;
*p = getVectorBigintValue_UTINYINT;
} else if (srcType == TSDB_DATA_TYPE_SMALLINT) {
p = getVectorBigintValue_SMALLINT;
*p = getVectorBigintValue_SMALLINT;
} else if (srcType == TSDB_DATA_TYPE_USMALLINT) {
p = getVectorBigintValue_USMALLINT;
*p = getVectorBigintValue_USMALLINT;
} else if (srcType == TSDB_DATA_TYPE_INT) {
p = getVectorBigintValue_INT;
*p = getVectorBigintValue_INT;
} else if (srcType == TSDB_DATA_TYPE_UINT) {
p = getVectorBigintValue_UINT;
*p = getVectorBigintValue_UINT;
} else if (srcType == TSDB_DATA_TYPE_BIGINT) {
p = getVectorBigintValue_BIGINT;
*p = getVectorBigintValue_BIGINT;
} else if (srcType == TSDB_DATA_TYPE_UBIGINT) {
p = getVectorBigintValue_UBIGINT;
*p = getVectorBigintValue_UBIGINT;
} else if (srcType == TSDB_DATA_TYPE_FLOAT) {
p = getVectorBigintValue_FLOAT;
*p = getVectorBigintValue_FLOAT;
} else if (srcType == TSDB_DATA_TYPE_DOUBLE) {
p = getVectorBigintValue_DOUBLE;
*p = getVectorBigintValue_DOUBLE;
} else if (srcType == TSDB_DATA_TYPE_TIMESTAMP) {
p = getVectorBigintValue_BIGINT;
*p = getVectorBigintValue_BIGINT;
} else if (srcType == TSDB_DATA_TYPE_BOOL) {
p = getVectorBigintValue_BOOL;
*p = getVectorBigintValue_BOOL;
} else if (srcType == TSDB_DATA_TYPE_JSON) {
p = getVectorBigintValue_JSON;
*p = getVectorBigintValue_JSON;
} else if (srcType == TSDB_DATA_TYPE_NULL) {
p = NULL;
*p = NULL;
} else {
ASSERT(0);
sclError("getVectorBigintValueFn invalid srcType : %d", srcType);
return TSDB_CODE_SCALAR_CONVERT_ERROR;
}
return p;
return TSDB_CODE_SUCCESS;
}
static FORCE_INLINE int32_t varToTimestamp(char *buf, SScalarParam *pOut, int32_t rowIndex, int32_t *overflow) {
@ -467,7 +472,7 @@ static FORCE_INLINE int32_t varToGeometry(char *buf, SScalarParam *pOut, int32_t
_return:
taosMemoryFree(output);
geosFreeBuffer(t);
ASSERT(t == NULL && len == 0);
t = NULL;
VarDataLenT dummyHeader = 0;
SCL_ERR_RET(colDataSetVal(pOut->columnData, rowIndex, (const char *)&dummyHeader, false));
SCL_RET(code);
@ -525,7 +530,7 @@ int32_t vectorConvertFromVarData(SSclVectorConvCtx *pCtx, int32_t *overflow) {
} else if (tTagIsJson(data) || *data == TSDB_DATA_TYPE_NULL) {
SCL_ERR_JRET(TSDB_CODE_QRY_JSON_NOT_SUPPORT_ERROR);
} else {
convertNumberToNumber(data + CHAR_BYTES, colDataGetNumData(pCtx->pOut->columnData, i), *data, pCtx->outType);
SCL_ERR_JRET(convertNumberToNumber(data + CHAR_BYTES, colDataGetNumData(pCtx->pOut->columnData, i), *data, pCtx->outType));
continue;
}
}
@ -582,7 +587,7 @@ int32_t getVectorDoubleValue_JSON(void *src, int32_t index, double *out) {
} else if (tTagIsJson(data)) {
SCL_ERR_RET(TSDB_CODE_QRY_JSON_NOT_SUPPORT_ERROR);
} else {
convertNumberToNumber(data + CHAR_BYTES, out, *data, TSDB_DATA_TYPE_DOUBLE);
SCL_ERR_RET(convertNumberToNumber(data + CHAR_BYTES, out, *data, TSDB_DATA_TYPE_DOUBLE));
}
SCL_RET(TSDB_CODE_SUCCESS);
}
@ -673,7 +678,7 @@ int32_t convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_
*result = false;
return TSDB_CODE_SUCCESS;
} else if (typeLeft != type) {
convertNumberToNumber(*pLeftData, pLeftOut, typeLeft, type);
SCL_ERR_RET(convertNumberToNumber(*pLeftData, pLeftOut, typeLeft, type));
*pLeftData = pLeftOut;
}
@ -683,7 +688,7 @@ int32_t convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_
*result = false;
return TSDB_CODE_SUCCESS;
} else if (typeRight != type) {
convertNumberToNumber(*pRightData, pRightOut, typeRight, type);
SCL_ERR_RET(convertNumberToNumber(*pRightData, pRightOut, typeRight, type));
*pRightData = pRightOut;
}
} else if (type == TSDB_DATA_TYPE_BINARY ||
@ -1130,8 +1135,10 @@ enum {
// TODO not correct for descending order scan
static int32_t vectorMathAddHelper(SColumnInfoData *pLeftCol, SColumnInfoData *pRightCol, SColumnInfoData *pOutputCol,
int32_t numOfRows, int32_t step, int32_t i) {
_getDoubleValue_fn_t getVectorDoubleValueFnLeft = getVectorDoubleValueFn(pLeftCol->info.type);
_getDoubleValue_fn_t getVectorDoubleValueFnRight = getVectorDoubleValueFn(pRightCol->info.type);
_getDoubleValue_fn_t getVectorDoubleValueFnLeft;
_getDoubleValue_fn_t getVectorDoubleValueFnRight;
SCL_ERR_RET(getVectorDoubleValueFn(pLeftCol->info.type, &getVectorDoubleValueFnLeft));
SCL_ERR_RET(getVectorDoubleValueFn(pRightCol->info.type, &getVectorDoubleValueFnRight));
double *output = (double *)pOutputCol->pData;
@ -1155,9 +1162,10 @@ static int32_t vectorMathAddHelper(SColumnInfoData *pLeftCol, SColumnInfoData *p
static int32_t vectorMathTsAddHelper(SColumnInfoData *pLeftCol, SColumnInfoData *pRightCol, SColumnInfoData *pOutputCol,
int32_t numOfRows, int32_t step, int32_t i) {
_getBigintValue_fn_t getVectorBigintValueFnLeft = getVectorBigintValueFn(pLeftCol->info.type);
_getBigintValue_fn_t getVectorBigintValueFnRight = getVectorBigintValueFn(pRightCol->info.type);
_getBigintValue_fn_t getVectorBigintValueFnLeft;
_getBigintValue_fn_t getVectorBigintValueFnRight;
SCL_ERR_RET(getVectorBigintValueFn(pLeftCol->info.type, &getVectorBigintValueFnLeft));
SCL_ERR_RET(getVectorBigintValueFn(pRightCol->info.type, &getVectorBigintValueFnRight));
int64_t *output = (int64_t *)pOutputCol->pData;
if (IS_HELPER_NULL(pRightCol, 0)) { // Set pLeft->numOfRows NULL value
@ -1230,8 +1238,10 @@ int32_t vectorMathAdd(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *p
(GET_PARAM_TYPE(pRight) == TSDB_DATA_TYPE_TIMESTAMP &&
GET_PARAM_TYPE(pLeft) == TSDB_DATA_TYPE_BOOL)) { // timestamp plus duration
int64_t *output = (int64_t *)pOutputCol->pData;
_getBigintValue_fn_t getVectorBigintValueFnLeft = getVectorBigintValueFn(pLeftCol->info.type);
_getBigintValue_fn_t getVectorBigintValueFnRight = getVectorBigintValueFn(pRightCol->info.type);
_getBigintValue_fn_t getVectorBigintValueFnLeft;
_getBigintValue_fn_t getVectorBigintValueFnRight;
SCL_ERR_JRET(getVectorBigintValueFn(pLeftCol->info.type, &getVectorBigintValueFnLeft));
SCL_ERR_JRET(getVectorBigintValueFn(pRightCol->info.type, &getVectorBigintValueFnRight));
if (pLeft->numOfRows == 1 && pRight->numOfRows == 1) {
if (GET_PARAM_TYPE(pLeft) == TSDB_DATA_TYPE_TIMESTAMP) {
@ -1258,9 +1268,10 @@ int32_t vectorMathAdd(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *p
}
} else {
double *output = (double *)pOutputCol->pData;
_getDoubleValue_fn_t getVectorDoubleValueFnLeft = getVectorDoubleValueFn(pLeftCol->info.type);
_getDoubleValue_fn_t getVectorDoubleValueFnRight = getVectorDoubleValueFn(pRightCol->info.type);
_getDoubleValue_fn_t getVectorDoubleValueFnLeft;
_getDoubleValue_fn_t getVectorDoubleValueFnRight;
SCL_ERR_JRET(getVectorDoubleValueFn(pLeftCol->info.type, &getVectorDoubleValueFnLeft));
SCL_ERR_JRET(getVectorDoubleValueFn(pRightCol->info.type, &getVectorDoubleValueFnRight));
if (pLeft->numOfRows == pRight->numOfRows) {
for (; i < pRight->numOfRows && i >= 0; i += step, output += 1) {
if (IS_NULL) {
@ -1289,8 +1300,10 @@ _return:
// TODO not correct for descending order scan
static int32_t vectorMathSubHelper(SColumnInfoData *pLeftCol, SColumnInfoData *pRightCol, SColumnInfoData *pOutputCol,
int32_t numOfRows, int32_t step, int32_t factor, int32_t i) {
_getDoubleValue_fn_t getVectorDoubleValueFnLeft = getVectorDoubleValueFn(pLeftCol->info.type);
_getDoubleValue_fn_t getVectorDoubleValueFnRight = getVectorDoubleValueFn(pRightCol->info.type);
_getDoubleValue_fn_t getVectorDoubleValueFnLeft;
_getDoubleValue_fn_t getVectorDoubleValueFnRight;
SCL_ERR_RET(getVectorDoubleValueFn(pLeftCol->info.type, &getVectorDoubleValueFnLeft));
SCL_ERR_RET(getVectorDoubleValueFn(pRightCol->info.type, &getVectorDoubleValueFnRight));
double *output = (double *)pOutputCol->pData;
@ -1314,8 +1327,10 @@ static int32_t vectorMathSubHelper(SColumnInfoData *pLeftCol, SColumnInfoData *p
static int32_t vectorMathTsSubHelper(SColumnInfoData *pLeftCol, SColumnInfoData *pRightCol, SColumnInfoData *pOutputCol,
int32_t numOfRows, int32_t step, int32_t factor, int32_t i) {
_getBigintValue_fn_t getVectorBigintValueFnLeft = getVectorBigintValueFn(pLeftCol->info.type);
_getBigintValue_fn_t getVectorBigintValueFnRight = getVectorBigintValueFn(pRightCol->info.type);
_getBigintValue_fn_t getVectorBigintValueFnLeft;
_getBigintValue_fn_t getVectorBigintValueFnRight;
SCL_ERR_RET(getVectorBigintValueFn(pLeftCol->info.type, &getVectorBigintValueFnLeft));
SCL_ERR_RET(getVectorBigintValueFn(pRightCol->info.type, &getVectorBigintValueFnRight));
int64_t *output = (int64_t *)pOutputCol->pData;
@ -1357,8 +1372,10 @@ int32_t vectorMathSub(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *p
(GET_PARAM_TYPE(pRight) == TSDB_DATA_TYPE_TIMESTAMP &&
GET_PARAM_TYPE(pLeft) == TSDB_DATA_TYPE_BIGINT)) { // timestamp minus duration
int64_t *output = (int64_t *)pOutputCol->pData;
_getBigintValue_fn_t getVectorBigintValueFnLeft = getVectorBigintValueFn(pLeftCol->info.type);
_getBigintValue_fn_t getVectorBigintValueFnRight = getVectorBigintValueFn(pRightCol->info.type);
_getBigintValue_fn_t getVectorBigintValueFnLeft;
_getBigintValue_fn_t getVectorBigintValueFnRight;
SCL_ERR_JRET(getVectorBigintValueFn(pLeftCol->info.type, &getVectorBigintValueFnLeft));
SCL_ERR_JRET(getVectorBigintValueFn(pRightCol->info.type, &getVectorBigintValueFnRight));
if (pLeft->numOfRows == 1 && pRight->numOfRows == 1) {
SCL_ERR_JRET(vectorMathTsSubHelper(pLeftCol, pRightCol, pOutputCol, pLeft->numOfRows, step, 1, i));
@ -1381,8 +1398,10 @@ int32_t vectorMathSub(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *p
}
} else {
double *output = (double *)pOutputCol->pData;
_getDoubleValue_fn_t getVectorDoubleValueFnLeft = getVectorDoubleValueFn(pLeftCol->info.type);
_getDoubleValue_fn_t getVectorDoubleValueFnRight = getVectorDoubleValueFn(pRightCol->info.type);
_getDoubleValue_fn_t getVectorDoubleValueFnLeft;
_getDoubleValue_fn_t getVectorDoubleValueFnRight;
SCL_ERR_JRET(getVectorDoubleValueFn(pLeftCol->info.type, &getVectorDoubleValueFnLeft));
SCL_ERR_JRET(getVectorDoubleValueFn(pRightCol->info.type, &getVectorDoubleValueFnRight));
if (pLeft->numOfRows == pRight->numOfRows) {
for (; i < pRight->numOfRows && i >= 0; i += step, output += 1) {
@ -1412,8 +1431,10 @@ _return:
// TODO not correct for descending order scan
static int32_t vectorMathMultiplyHelper(SColumnInfoData *pLeftCol, SColumnInfoData *pRightCol, SColumnInfoData *pOutputCol,
int32_t numOfRows, int32_t step, int32_t i) {
_getDoubleValue_fn_t getVectorDoubleValueFnLeft = getVectorDoubleValueFn(pLeftCol->info.type);
_getDoubleValue_fn_t getVectorDoubleValueFnRight = getVectorDoubleValueFn(pRightCol->info.type);
_getDoubleValue_fn_t getVectorDoubleValueFnLeft;
_getDoubleValue_fn_t getVectorDoubleValueFnRight;
SCL_ERR_RET(getVectorDoubleValueFn(pLeftCol->info.type, &getVectorDoubleValueFnLeft));
SCL_ERR_RET(getVectorDoubleValueFn(pRightCol->info.type, &getVectorDoubleValueFnRight));
double *output = (double *)pOutputCol->pData;
@ -1449,8 +1470,10 @@ int32_t vectorMathMultiply(SScalarParam *pLeft, SScalarParam *pRight, SScalarPar
SCL_ERR_JRET(vectorConvertVarToDouble(pLeft, &leftConvert, &pLeftCol));
SCL_ERR_JRET(vectorConvertVarToDouble(pRight, &rightConvert, &pRightCol));
_getDoubleValue_fn_t getVectorDoubleValueFnLeft = getVectorDoubleValueFn(pLeftCol->info.type);
_getDoubleValue_fn_t getVectorDoubleValueFnRight = getVectorDoubleValueFn(pRightCol->info.type);
_getDoubleValue_fn_t getVectorDoubleValueFnLeft;
_getDoubleValue_fn_t getVectorDoubleValueFnRight;
SCL_ERR_JRET(getVectorDoubleValueFn(pLeftCol->info.type, &getVectorDoubleValueFnLeft));
SCL_ERR_JRET(getVectorDoubleValueFn(pRightCol->info.type, &getVectorDoubleValueFnRight));
double *output = (double *)pOutputCol->pData;
if (pLeft->numOfRows == pRight->numOfRows) {
@ -1491,8 +1514,10 @@ int32_t vectorMathDivide(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam
SCL_ERR_JRET(vectorConvertVarToDouble(pLeft, &leftConvert, &pLeftCol));
SCL_ERR_JRET(vectorConvertVarToDouble(pRight, &rightConvert, &pRightCol));
_getDoubleValue_fn_t getVectorDoubleValueFnLeft = getVectorDoubleValueFn(pLeftCol->info.type);
_getDoubleValue_fn_t getVectorDoubleValueFnRight = getVectorDoubleValueFn(pRightCol->info.type);
_getDoubleValue_fn_t getVectorDoubleValueFnLeft;
_getDoubleValue_fn_t getVectorDoubleValueFnRight;
SCL_ERR_JRET(getVectorDoubleValueFn(pLeftCol->info.type, &getVectorDoubleValueFnLeft));
SCL_ERR_JRET(getVectorDoubleValueFn(pRightCol->info.type, &getVectorDoubleValueFnRight));
double *output = (double *)pOutputCol->pData;
if (pLeft->numOfRows == pRight->numOfRows) {
@ -1573,8 +1598,10 @@ int32_t vectorMathRemainder(SScalarParam *pLeft, SScalarParam *pRight, SScalarPa
SCL_ERR_JRET(vectorConvertVarToDouble(pLeft, &leftConvert, &pLeftCol));
SCL_ERR_JRET(vectorConvertVarToDouble(pRight, &rightConvert, &pRightCol));
_getDoubleValue_fn_t getVectorDoubleValueFnLeft = getVectorDoubleValueFn(pLeftCol->info.type);
_getDoubleValue_fn_t getVectorDoubleValueFnRight = getVectorDoubleValueFn(pRightCol->info.type);
_getDoubleValue_fn_t getVectorDoubleValueFnLeft;
_getDoubleValue_fn_t getVectorDoubleValueFnRight;
SCL_ERR_JRET(getVectorDoubleValueFn(pLeftCol->info.type, &getVectorDoubleValueFnLeft));
SCL_ERR_JRET(getVectorDoubleValueFn(pRightCol->info.type, &getVectorDoubleValueFnRight));
double *output = (double *)pOutputCol->pData;
@ -1661,7 +1688,8 @@ int32_t vectorMathMinus(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam
SColumnInfoData *pLeftCol = NULL;
SCL_ERR_JRET(vectorConvertVarToDouble(pLeft, &leftConvert, &pLeftCol));
_getDoubleValue_fn_t getVectorDoubleValueFnLeft = getVectorDoubleValueFn(pLeftCol->info.type);
_getDoubleValue_fn_t getVectorDoubleValueFnLeft;
SCL_ERR_JRET(getVectorDoubleValueFn(pLeftCol->info.type, &getVectorDoubleValueFnLeft));
double *output = (double *)pOutputCol->pData;
for (; i < pLeft->numOfRows && i >= 0; i += step, output += 1) {
@ -1692,15 +1720,20 @@ int32_t vectorAssign(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *pO
}
}
ASSERT(pRight->numOfQualified == 1 || pRight->numOfQualified == 0);
if (pRight->numOfQualified != 1 && pRight->numOfQualified != 0) {
sclError("vectorAssign: invalid qualified number %d", pRight->numOfQualified);
SCL_ERR_RET(TSDB_CODE_APP_ERROR);
}
pOut->numOfQualified = pRight->numOfQualified * pOut->numOfRows;
return TSDB_CODE_SUCCESS;
}
static int32_t vectorBitAndHelper(SColumnInfoData *pLeftCol, SColumnInfoData *pRightCol, SColumnInfoData *pOutputCol,
int32_t numOfRows, int32_t step, int32_t i) {
_getBigintValue_fn_t getVectorBigintValueFnLeft = getVectorBigintValueFn(pLeftCol->info.type);
_getBigintValue_fn_t getVectorBigintValueFnRight = getVectorBigintValueFn(pRightCol->info.type);
_getBigintValue_fn_t getVectorBigintValueFnLeft;
_getBigintValue_fn_t getVectorBigintValueFnRight;
SCL_ERR_RET(getVectorBigintValueFn(pLeftCol->info.type, &getVectorBigintValueFnLeft));
SCL_ERR_RET(getVectorBigintValueFn(pRightCol->info.type, &getVectorBigintValueFnRight));
int64_t *output = (int64_t *)pOutputCol->pData;
@ -1736,8 +1769,10 @@ int32_t vectorBitAnd(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *pO
SCL_ERR_JRET(vectorConvertVarToDouble(pLeft, &leftConvert, &pLeftCol));
SCL_ERR_JRET(vectorConvertVarToDouble(pRight, &rightConvert, &pRightCol));
_getBigintValue_fn_t getVectorBigintValueFnLeft = getVectorBigintValueFn(pLeftCol->info.type);
_getBigintValue_fn_t getVectorBigintValueFnRight = getVectorBigintValueFn(pRightCol->info.type);
_getBigintValue_fn_t getVectorBigintValueFnLeft;
_getBigintValue_fn_t getVectorBigintValueFnRight;
SCL_ERR_JRET(getVectorBigintValueFn(pLeftCol->info.type, &getVectorBigintValueFnLeft));
SCL_ERR_JRET(getVectorBigintValueFn(pRightCol->info.type, &getVectorBigintValueFnRight));
int64_t *output = (int64_t *)pOutputCol->pData;
if (pLeft->numOfRows == pRight->numOfRows) {
@ -1766,8 +1801,10 @@ _return:
static int32_t vectorBitOrHelper(SColumnInfoData *pLeftCol, SColumnInfoData *pRightCol, SColumnInfoData *pOutputCol,
int32_t numOfRows, int32_t step, int32_t i) {
_getBigintValue_fn_t getVectorBigintValueFnLeft = getVectorBigintValueFn(pLeftCol->info.type);
_getBigintValue_fn_t getVectorBigintValueFnRight = getVectorBigintValueFn(pRightCol->info.type);
_getBigintValue_fn_t getVectorBigintValueFnLeft;
_getBigintValue_fn_t getVectorBigintValueFnRight;
SCL_ERR_RET(getVectorBigintValueFn(pLeftCol->info.type, &getVectorBigintValueFnLeft));
SCL_ERR_RET(getVectorBigintValueFn(pRightCol->info.type, &getVectorBigintValueFnRight));
int64_t *output = (int64_t *)pOutputCol->pData;
@ -1803,8 +1840,10 @@ int32_t vectorBitOr(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *pOu
SCL_ERR_JRET(vectorConvertVarToDouble(pLeft, &leftConvert, &pLeftCol));
SCL_ERR_JRET(vectorConvertVarToDouble(pRight, &rightConvert, &pRightCol));
_getBigintValue_fn_t getVectorBigintValueFnLeft = getVectorBigintValueFn(pLeftCol->info.type);
_getBigintValue_fn_t getVectorBigintValueFnRight = getVectorBigintValueFn(pRightCol->info.type);
_getBigintValue_fn_t getVectorBigintValueFnLeft;
_getBigintValue_fn_t getVectorBigintValueFnRight;
SCL_ERR_JRET(getVectorBigintValueFn(pLeftCol->info.type, &getVectorBigintValueFnLeft));
SCL_ERR_JRET(getVectorBigintValueFn(pRightCol->info.type, &getVectorBigintValueFnRight));
int64_t *output = (int64_t *)pOutputCol->pData;
if (pLeft->numOfRows == pRight->numOfRows) {
@ -1892,7 +1931,8 @@ int32_t doVectorCompareImpl(SScalarParam *pLeft, SScalarParam *pRight, SScalarPa
&leftOut, &rightOut, &isJsonnull, &freeLeft, &freeRight, &result));
if (isJsonnull) {
ASSERT(0);
sclError("doVectorCompareImpl: invalid json null value");
SCL_ERR_RET(TSDB_CODE_APP_ERROR);
}
if (!pLeftData || !pRightData) {

View File

@ -1,7 +1,7 @@
MESSAGE(STATUS "build filter unit test")
IF(NOT TD_DARWIN)
IF(TD_DARWIN)
# GoogleTest requires at least C++11
SET(CMAKE_CXX_STANDARD 11)
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)

View File

@ -113,8 +113,7 @@ int32_t flttMakeColumnNode(SNode **pNode, SSDataBlock **block, int32_t dataType,
if (NULL == *block) {
SSDataBlock *res = NULL;
int32_t code = createDataBlock(&res);
ASSERT(code == 0);
FLT_ERR_RET(createDataBlock(&res));
for (int32_t i = 0; i < 2; ++i) {
SColumnInfoData idata = createColumnInfoData(TSDB_DATA_TYPE_NULL, 10, 1 + i);

View File

@ -115,7 +115,10 @@ int32_t scltAppendReservedSlot(SArray *pBlockList, int16_t *dataBlockId, int16_t
res->info.capacity = rows;
res->info.rows = rows;
SColumnInfoData *p = static_cast<SColumnInfoData *>(taosArrayGet(res->pDataBlock, 0));
ASSERT(p->pData != NULL && p->nullbitmap != NULL);
if (p->pData == NULL || p->nullbitmap == NULL) {
sclError("data block is not initialized since pData or nullbitmap is NULL");
SCL_ERR_RET(TSDB_CODE_APP_ERROR);
}
(void)taosArrayPush(pBlockList, &res);
*dataBlockId = taosArrayGetSize(pBlockList) - 1;
@ -189,8 +192,7 @@ int32_t scltMakeColumnNode(SNode **pNode, SSDataBlock **block, int32_t dataType,
if (NULL == *block) {
SSDataBlock *res = NULL;
int32_t code = createDataBlock(&res);
ASSERT(code == 0);
SCL_ERR_RET(createDataBlock(&res));
for (int32_t i = 0; i < 2; ++i) {
SColumnInfoData idata = createColumnInfoData(TSDB_DATA_TYPE_INT, 10, i + 1);
@ -1422,8 +1424,10 @@ int32_t makeCalculate(void *json, void *key, int32_t rightType, void *rightData,
opType == OP_TYPE_NMATCH) {
(void)printf("op:%s,3result:%d,except:%f\n", operatorTypeStr(opType), *((bool *)colDataGetData(column, 0)),
exceptValue);
assert(*(bool *)colDataGetData(column, 0) == exceptValue);
// ASSERT_EQ((int) *((bool *)colDataGetData(column, 0)), (int)exceptValue);
if(*(bool *)colDataGetData(column, 0) != exceptValue) {
(void)printf("expect value %d, but got %d\n", *((bool *)colDataGetData(column, 0)), exceptValue);
SCL_ERR_RET(TSDB_CODE_FAILED);
}
}
taosArrayDestroyEx(blockList, scltFreeDataBlock);

View File

@ -478,6 +478,9 @@ TAOS_DEFINE_ERROR(TSDB_CODE_QRY_INVALID_WINDOW_CONDITION, "The time pseudo colum
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR, "Executor internal error")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_INVALID_JOIN_CONDITION, "Not supported join on condition")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_FILTER_NOT_SUPPORT_TYPE, "Not supported range type")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_FILTER_WRONG_OPTR_TYPE, "Wrong operator type")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_FILTER_RANGE_ERROR, "Wrong filter range")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_FILTER_INVALID_TYPE, "Invalid filter type")
// grant
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_EXPIRED, "License expired")