add unit test
This commit is contained in:
parent
f1a9b5890f
commit
014740decf
|
@ -401,6 +401,32 @@ char tTokenTypeSwitcher[13] = {
|
|||
TSDB_DATA_TYPE_NCHAR, // TK_NCHAR
|
||||
};
|
||||
|
||||
float floatMin = -FLT_MAX, floatMax = FLT_MAX;
|
||||
double doubleMin = -DBL_MAX, doubleMax = DBL_MAX;
|
||||
|
||||
FORCE_INLINE void* getDataMin(int32_t type) {
|
||||
switch (type) {
|
||||
case TSDB_DATA_TYPE_FLOAT:
|
||||
return &floatMin;
|
||||
case TSDB_DATA_TYPE_DOUBLE:
|
||||
return &doubleMin;
|
||||
default:
|
||||
return &tDataTypes[type].minValue;
|
||||
}
|
||||
}
|
||||
|
||||
FORCE_INLINE void* getDataMax(int32_t type) {
|
||||
switch (type) {
|
||||
case TSDB_DATA_TYPE_FLOAT:
|
||||
return &floatMax;
|
||||
case TSDB_DATA_TYPE_DOUBLE:
|
||||
return &doubleMax;
|
||||
default:
|
||||
return &tDataTypes[type].maxValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool isValidDataType(int32_t type) {
|
||||
return type >= TSDB_DATA_TYPE_NULL && type <= TSDB_DATA_TYPE_UBIGINT;
|
||||
}
|
||||
|
|
|
@ -184,6 +184,8 @@ void *getNullValue(int32_t type);
|
|||
void assignVal(char *val, const char *src, int32_t len, int32_t type);
|
||||
void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size, void* buf);
|
||||
void operateVal(void *dst, void *s1, void *s2, int32_t optr, int32_t type);
|
||||
void* getDataMin(int32_t type);
|
||||
void* getDataMax(int32_t type);
|
||||
|
||||
int32_t tStrToInteger(const char* z, int16_t type, int32_t n, int64_t* value, bool issigned);
|
||||
|
||||
|
|
|
@ -181,7 +181,6 @@ extern int32_t filterInitFromTree(tExprNode* tree, SFilterInfo **pinfo);
|
|||
extern bool filterExecute(SFilterInfo *info, int32_t numOfRows, int8_t* p);
|
||||
extern int32_t filterSetColFieldData(SFilterInfo *info, int16_t colId, void *data);
|
||||
extern void* filterInitMergeRange(int32_t type, int32_t options);
|
||||
extern int32_t filterAddMergeRange(void* h, void* s, void* e, int32_t optr);
|
||||
extern int32_t filterGetMergeRangeNum(void* h, int32_t* num);
|
||||
extern int32_t filterGetMergeRangeRes(void* h, void *s, void* e);
|
||||
extern int32_t filterFreeMergeRange(void* h);
|
||||
|
|
|
@ -66,8 +66,8 @@ static FORCE_INLINE SFilterRangeNode* filterNewRange(SFilterRMCtx *ctx, int32_t
|
|||
r = calloc(1, sizeof(SFilterRangeNode));
|
||||
}
|
||||
|
||||
SIMPLE_COPY_VALUES((char*)&r->s, s);
|
||||
SIMPLE_COPY_VALUES((char*)&r->e, e);
|
||||
SIMPLE_COPY_VALUES((char*)&r->ra.s, s);
|
||||
SIMPLE_COPY_VALUES((char*)&r->ra.e, e);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -87,23 +87,6 @@ void* filterInitMergeRange(int32_t type, int32_t options) {
|
|||
return ctx;
|
||||
}
|
||||
|
||||
int32_t filterAddMergeRangeCtx(void *dst, void *src, int32_t optr) {
|
||||
SFilterRMCtx *dctx = (SFilterRMCtx *)dst;
|
||||
SFilterRMCtx *sctx = (SFilterRMCtx *)src;
|
||||
|
||||
if (sctx->rs == NULL) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
SFilterRangeNode *r = sctx->rs;
|
||||
|
||||
while (r) {
|
||||
filterAddMergeRange(dctx, &r->s, &r->e, optr);
|
||||
r = r->next;
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t filterResetMergeRangeCtx(SFilterRMCtx *ctx) {
|
||||
ctx->status = 0;
|
||||
|
@ -154,24 +137,24 @@ int32_t filterAddMergeRangeImpl(void* h, void* s, void* e, char sflag, char efla
|
|||
|
||||
if (optr == TSDB_RELATION_AND) {
|
||||
while (r != NULL) {
|
||||
if (ctx->pCompareFunc(&r->s, e) > 0) {
|
||||
if (ctx->pCompareFunc(&r->ra.s, e) > 0) {
|
||||
FREE_FROM_RANGE(ctx, r);
|
||||
break;
|
||||
}
|
||||
|
||||
if (ctx->pCompareFunc(s, &r->e) > 0) {
|
||||
if (ctx->pCompareFunc(s, &r->ra.e) > 0) {
|
||||
rn = r->next;
|
||||
FREE_RANGE(ctx, r);
|
||||
r = rn;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ctx->pCompareFunc(s, &r->s) > 0) {
|
||||
SIMPLE_COPY_VALUES((char *)&r->s, s);
|
||||
if (ctx->pCompareFunc(s, &r->ra.s) > 0) {
|
||||
SIMPLE_COPY_VALUES((char *)&r->ra.s, s);
|
||||
}
|
||||
|
||||
if (ctx->pCompareFunc(&r->e, e) > 0) {
|
||||
SIMPLE_COPY_VALUES((char *)&r->e, e);
|
||||
if (ctx->pCompareFunc(&r->ra.e, e) > 0) {
|
||||
SIMPLE_COPY_VALUES((char *)&r->ra.e, e);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -187,7 +170,7 @@ int32_t filterAddMergeRangeImpl(void* h, void* s, void* e, char sflag, char efla
|
|||
bool emerged = false;
|
||||
|
||||
while (r != NULL) {
|
||||
if (ctx->pCompareFunc(&r->s, e) > 0) {
|
||||
if (ctx->pCompareFunc(&r->ra.s, e) > 0) {
|
||||
if (emerged == false) {
|
||||
INSERT_RANGE(ctx, r, ctx->type, s, e);
|
||||
}
|
||||
|
@ -195,7 +178,7 @@ int32_t filterAddMergeRangeImpl(void* h, void* s, void* e, char sflag, char efla
|
|||
break;
|
||||
}
|
||||
|
||||
if (ctx->pCompareFunc(s, &r->e) > 0) {
|
||||
if (ctx->pCompareFunc(s, &r->ra.e) > 0) {
|
||||
if (r->next) {
|
||||
r= r->next;
|
||||
continue;
|
||||
|
@ -206,18 +189,18 @@ int32_t filterAddMergeRangeImpl(void* h, void* s, void* e, char sflag, char efla
|
|||
}
|
||||
|
||||
if (smerged == false) {
|
||||
if (ctx->pCompareFunc(&r->s, s) > 0) {
|
||||
SIMPLE_COPY_VALUES((char *)&r->s, s);
|
||||
if (ctx->pCompareFunc(&r->ra.s, s) > 0) {
|
||||
SIMPLE_COPY_VALUES((char *)&r->ra.s, s);
|
||||
}
|
||||
|
||||
smerged = true;
|
||||
}
|
||||
|
||||
if (emerged == false) {
|
||||
if (ctx->pCompareFunc(e, &r->e) > 0) {
|
||||
SIMPLE_COPY_VALUES((char *)&r->e, e);
|
||||
if (ctx->pCompareFunc(e, &r->ra.e) > 0) {
|
||||
SIMPLE_COPY_VALUES((char *)&r->ra.e, e);
|
||||
emerged = true;
|
||||
e = &r->e;
|
||||
e = &r->ra.e;
|
||||
r = r->next;
|
||||
continue;
|
||||
}
|
||||
|
@ -225,14 +208,14 @@ int32_t filterAddMergeRangeImpl(void* h, void* s, void* e, char sflag, char efla
|
|||
break;
|
||||
}
|
||||
|
||||
if (ctx->pCompareFunc(e, &r->e) > 0) {
|
||||
if (ctx->pCompareFunc(e, &r->ra.e) > 0) {
|
||||
rn = r->next;
|
||||
FREE_RANGE(ctx, r);
|
||||
r = rn;
|
||||
|
||||
continue;
|
||||
} else {
|
||||
SIMPLE_COPY_VALUES(e, (char *)&r->e);
|
||||
SIMPLE_COPY_VALUES(e, (char *)&r->ra.e);
|
||||
FREE_RANGE(ctx, r);
|
||||
|
||||
break;
|
||||
|
@ -246,25 +229,43 @@ int32_t filterAddMergeRange(void* h, SFilterRange* ra, int32_t optr) {
|
|||
SFilterRMCtx *ctx = (SFilterRMCtx *)h;
|
||||
int64_t sv, ev;
|
||||
void *s, *e;
|
||||
char sflag = 0, eflag = 0;
|
||||
|
||||
if (MR_GET_FLAG(ra->sflag, RA_NULL)) {
|
||||
SIMPLE_COPY_VALUES(&sv, &tDataTypes[ctx->type].minValue);
|
||||
SIMPLE_COPY_VALUES(&sv, getDataMin(ctx->type));
|
||||
s = &sv;
|
||||
} else {
|
||||
s = &ra.s;
|
||||
s = &ra->s;
|
||||
}
|
||||
|
||||
if (MR_GET_FLAG(ra->eflag, RA_NULL)) {
|
||||
SIMPLE_COPY_VALUES(&ev, &tDataTypes[ctx->type].maxValue);
|
||||
SIMPLE_COPY_VALUES(&ev, getDataMax(ctx->type));
|
||||
e = &ev;
|
||||
} else {
|
||||
e = &ra.e;
|
||||
e = &ra->e;
|
||||
}
|
||||
|
||||
return filterAddMergeRangeImpl(h, s, e, ra.sflag, ra.eflag, optr);
|
||||
return filterAddMergeRangeImpl(h, s, e, ra->sflag, ra->eflag, optr);
|
||||
}
|
||||
|
||||
int32_t filterAddMergeRangeCtx(void *dst, void *src, int32_t optr) {
|
||||
SFilterRMCtx *dctx = (SFilterRMCtx *)dst;
|
||||
SFilterRMCtx *sctx = (SFilterRMCtx *)src;
|
||||
|
||||
if (sctx->rs == NULL) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
SFilterRangeNode *r = sctx->rs;
|
||||
|
||||
while (r) {
|
||||
filterAddMergeRange(dctx, &r->ra, optr);
|
||||
r = r->next;
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int32_t filterFinMergeRange(void* h) {
|
||||
SFilterRMCtx *ctx = (SFilterRMCtx *)h;
|
||||
|
||||
|
@ -278,10 +279,10 @@ int32_t filterFinMergeRange(void* h) {
|
|||
|
||||
while (r && r->next) {
|
||||
int64_t tmp = 1;
|
||||
operateVal(&tmp, &r->e, &tmp, TSDB_BINARY_OP_ADD, ctx->type);
|
||||
if (ctx->pCompareFunc(&tmp, &r->next->s) == 0) {
|
||||
operateVal(&tmp, &r->ra.e, &tmp, TSDB_BINARY_OP_ADD, ctx->type);
|
||||
if (ctx->pCompareFunc(&tmp, &r->next->ra.s) == 0) {
|
||||
rn = r->next;
|
||||
SIMPLE_COPY_VALUES((char *)&r->next->s, (char *)&r->s);
|
||||
SIMPLE_COPY_VALUES((char *)&r->next->ra.s, (char *)&r->ra.s);
|
||||
FREE_RANGE(ctx, r);
|
||||
r = rn;
|
||||
|
||||
|
@ -323,8 +324,8 @@ int32_t filterGetMergeRangeRes(void* h, void *s, void* e) {
|
|||
SFilterRangeNode* r = ctx->rs;
|
||||
|
||||
while (r) {
|
||||
assignVal(s + num * tDataTypes[ctx->type].bytes, (char *)&r->s, 0, ctx->type);
|
||||
assignVal(e + num * tDataTypes[ctx->type].bytes, (char *)&r->e, 0, ctx->type);
|
||||
assignVal(s + num * tDataTypes[ctx->type].bytes, (char *)&r->ra.s, 0, ctx->type);
|
||||
assignVal(e + num * tDataTypes[ctx->type].bytes, (char *)&r->ra.e, 0, ctx->type);
|
||||
|
||||
++num;
|
||||
r = r->next;
|
||||
|
@ -567,7 +568,7 @@ void filterDumpInfoToString(SFilterInfo *info, const char *msg) {
|
|||
qDebug("Unit Num:%u", info->unitNum);
|
||||
for (uint16_t i = 0; i < info->unitNum; ++i) {
|
||||
SFilterUnit *unit = &info->units[i];
|
||||
SFilterField *left = FILTER_UNIT_LEFT_FIELD(info);
|
||||
SFilterField *left = FILTER_UNIT_LEFT_FIELD(info, unit);
|
||||
SFilterField *right = FILTER_UNIT_RIGHT_FIELD(info, unit);
|
||||
|
||||
SSchema *sch = left->desc;
|
||||
|
@ -900,7 +901,7 @@ bool filterExecute(SFilterInfo *info, int32_t numOfRows, int8_t* p) {
|
|||
ures = FILTER_UNIT_GET_R(info, uidx);
|
||||
} else {
|
||||
SFilterUnit *unit = &info->units[uidx];
|
||||
SFilterField *left = FILTER_UNIT_LEFT_FIELD(info);
|
||||
SFilterField *left = FILTER_UNIT_LEFT_FIELD(info, unit);
|
||||
SFilterField *right = FILTER_UNIT_RIGHT_FIELD(info, unit);
|
||||
|
||||
if (isNull(FILTER_GET_COL_FIELD_DATA(left, i), FILTER_GET_COL_FIELD_TYPE(left))) {
|
||||
|
|
|
@ -10,11 +10,17 @@
|
|||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
|
||||
extern "C" {
|
||||
extern int32_t filterAddMergeRange(void* h, SFilterRange* ra, int32_t optr);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
void intDataTest() {
|
||||
printf("running %s\n", __FUNCTION__);
|
||||
int32_t asize = 0;
|
||||
SFilterRange ra = {0};
|
||||
int64_t *s =NULL;
|
||||
int64_t *e =NULL;
|
||||
int64_t s0[3] = {-100, 1, 3};
|
||||
|
@ -40,7 +46,9 @@ void intDataTest() {
|
|||
asize = sizeof(s0)/sizeof(s[0]);
|
||||
void *h = filterInitMergeRange(TSDB_DATA_TYPE_BIGINT, 0);
|
||||
for (int32_t i = 0; i < asize; ++i) {
|
||||
filterAddMergeRange(h, s + i, e + i, TSDB_RELATION_AND);
|
||||
ra.s = s[i];
|
||||
ra.e = e[i];
|
||||
filterAddMergeRange(h, &ra, TSDB_RELATION_AND);
|
||||
}
|
||||
filterGetMergeRangeNum(h, &num);
|
||||
ASSERT_EQ(num, 0);
|
||||
|
@ -49,7 +57,10 @@ void intDataTest() {
|
|||
|
||||
h = filterInitMergeRange(TSDB_DATA_TYPE_BIGINT, 0);
|
||||
for (int32_t i = 0; i < asize; ++i) {
|
||||
filterAddMergeRange(h, s + i, e + i, TSDB_RELATION_OR);
|
||||
ra.s = s[i];
|
||||
ra.e = e[i];
|
||||
|
||||
filterAddMergeRange(h, &ra, TSDB_RELATION_OR);
|
||||
}
|
||||
filterGetMergeRangeNum(h, &num);
|
||||
ASSERT_EQ(num, 3);
|
||||
|
@ -65,7 +76,10 @@ void intDataTest() {
|
|||
|
||||
h = filterInitMergeRange(TSDB_DATA_TYPE_BIGINT, MR_OPT_TS);
|
||||
for (int32_t i = 0; i < asize; ++i) {
|
||||
filterAddMergeRange(h, s + i, e + i, TSDB_RELATION_OR);
|
||||
ra.s = s[i];
|
||||
ra.e = e[i];
|
||||
|
||||
filterAddMergeRange(h, &ra, TSDB_RELATION_OR);
|
||||
}
|
||||
filterGetMergeRangeNum(h, &num);
|
||||
ASSERT_EQ(num, 1);
|
||||
|
@ -80,7 +94,10 @@ void intDataTest() {
|
|||
asize = sizeof(s1)/sizeof(s[0]);
|
||||
h = filterInitMergeRange(TSDB_DATA_TYPE_BIGINT, 0);
|
||||
for (int32_t i = 0; i < asize; ++i) {
|
||||
filterAddMergeRange(h, s + i, e + i, TSDB_RELATION_AND);
|
||||
ra.s = s[i];
|
||||
ra.e = e[i];
|
||||
|
||||
filterAddMergeRange(h, &ra, TSDB_RELATION_AND);
|
||||
}
|
||||
filterGetMergeRangeNum(h, &num);
|
||||
ASSERT_EQ(num, 1);
|
||||
|
@ -92,7 +109,10 @@ void intDataTest() {
|
|||
|
||||
h = filterInitMergeRange(TSDB_DATA_TYPE_BIGINT, 0);
|
||||
for (int32_t i = 0; i < asize; ++i) {
|
||||
filterAddMergeRange(h, s + i, e + i, TSDB_RELATION_OR);
|
||||
ra.s = s[i];
|
||||
ra.e = e[i];
|
||||
|
||||
filterAddMergeRange(h, &ra, TSDB_RELATION_OR);
|
||||
}
|
||||
filterGetMergeRangeNum(h, &num);
|
||||
ASSERT_EQ(num, 1);
|
||||
|
@ -107,7 +127,10 @@ void intDataTest() {
|
|||
asize = sizeof(s2)/sizeof(s[0]);
|
||||
h = filterInitMergeRange(TSDB_DATA_TYPE_BIGINT, 0);
|
||||
for (int32_t i = 0; i < asize; ++i) {
|
||||
filterAddMergeRange(h, s + i, e + i, TSDB_RELATION_AND);
|
||||
ra.s = s[i];
|
||||
ra.e = e[i];
|
||||
|
||||
filterAddMergeRange(h, &ra, TSDB_RELATION_AND);
|
||||
}
|
||||
filterGetMergeRangeNum(h, &num);
|
||||
ASSERT_EQ(num, 0);
|
||||
|
@ -116,7 +139,10 @@ void intDataTest() {
|
|||
|
||||
h = filterInitMergeRange(TSDB_DATA_TYPE_BIGINT, 0);
|
||||
for (int32_t i = 0; i < asize; ++i) {
|
||||
filterAddMergeRange(h, s + i, e + i, TSDB_RELATION_OR);
|
||||
ra.s = s[i];
|
||||
ra.e = e[i];
|
||||
|
||||
filterAddMergeRange(h, &ra, TSDB_RELATION_OR);
|
||||
}
|
||||
filterGetMergeRangeNum(h, &num);
|
||||
ASSERT_EQ(num, 1);
|
||||
|
@ -129,7 +155,10 @@ void intDataTest() {
|
|||
|
||||
h = filterInitMergeRange(TSDB_DATA_TYPE_BIGINT, 0);
|
||||
for (int32_t i = 0; i < asize; ++i) {
|
||||
filterAddMergeRange(h, s + i, e + i, i % 2 ? TSDB_RELATION_OR : TSDB_RELATION_AND);
|
||||
ra.s = s[i];
|
||||
ra.e = e[i];
|
||||
|
||||
filterAddMergeRange(h, &ra, i % 2 ? TSDB_RELATION_OR : TSDB_RELATION_AND);
|
||||
}
|
||||
filterGetMergeRangeNum(h, &num);
|
||||
ASSERT_EQ(num, 0);
|
||||
|
@ -138,7 +167,10 @@ void intDataTest() {
|
|||
|
||||
h = filterInitMergeRange(TSDB_DATA_TYPE_BIGINT, 0);
|
||||
for (int32_t i = 0; i < asize; ++i) {
|
||||
filterAddMergeRange(h, s + i, e + i, i % 2 ? TSDB_RELATION_AND : TSDB_RELATION_OR);
|
||||
ra.s = s[i];
|
||||
ra.e = e[i];
|
||||
|
||||
filterAddMergeRange(h, &ra, i % 2 ? TSDB_RELATION_AND : TSDB_RELATION_OR);
|
||||
}
|
||||
filterGetMergeRangeNum(h, &num);
|
||||
ASSERT_EQ(num, 1);
|
||||
|
@ -153,7 +185,10 @@ void intDataTest() {
|
|||
asize = sizeof(s3)/sizeof(s[0]);
|
||||
h = filterInitMergeRange(TSDB_DATA_TYPE_BIGINT, 0);
|
||||
for (int32_t i = 0; i < asize; ++i) {
|
||||
filterAddMergeRange(h, s + i, e + i, TSDB_RELATION_AND);
|
||||
ra.s = s[i];
|
||||
ra.e = e[i];
|
||||
|
||||
filterAddMergeRange(h, &ra, TSDB_RELATION_AND);
|
||||
}
|
||||
filterGetMergeRangeNum(h, &num);
|
||||
ASSERT_EQ(num, 0);
|
||||
|
@ -162,7 +197,10 @@ void intDataTest() {
|
|||
|
||||
h = filterInitMergeRange(TSDB_DATA_TYPE_BIGINT, 0);
|
||||
for (int32_t i = 0; i < asize; ++i) {
|
||||
filterAddMergeRange(h, s + i, e + i, TSDB_RELATION_OR);
|
||||
ra.s = s[i];
|
||||
ra.e = e[i];
|
||||
|
||||
filterAddMergeRange(h, &ra, TSDB_RELATION_OR);
|
||||
}
|
||||
filterGetMergeRangeNum(h, &num);
|
||||
ASSERT_EQ(num, 1);
|
||||
|
@ -179,7 +217,10 @@ void intDataTest() {
|
|||
asize = sizeof(s4)/sizeof(s[0]);
|
||||
h = filterInitMergeRange(TSDB_DATA_TYPE_BIGINT, 0);
|
||||
for (int32_t i = 0; i < asize; ++i) {
|
||||
filterAddMergeRange(h, s + i, e + i, TSDB_RELATION_AND);
|
||||
ra.s = s[i];
|
||||
ra.e = e[i];
|
||||
|
||||
filterAddMergeRange(h, &ra, TSDB_RELATION_AND);
|
||||
}
|
||||
filterGetMergeRangeNum(h, &num);
|
||||
ASSERT_EQ(num, 0);
|
||||
|
@ -188,7 +229,10 @@ void intDataTest() {
|
|||
|
||||
h = filterInitMergeRange(TSDB_DATA_TYPE_BIGINT, 0);
|
||||
for (int32_t i = 0; i < asize; ++i) {
|
||||
filterAddMergeRange(h, s + i, e + i, TSDB_RELATION_OR);
|
||||
ra.s = s[i];
|
||||
ra.e = e[i];
|
||||
|
||||
filterAddMergeRange(h, &ra, TSDB_RELATION_OR);
|
||||
}
|
||||
filterGetMergeRangeNum(h, &num);
|
||||
ASSERT_EQ(num, 2);
|
||||
|
@ -205,7 +249,10 @@ void intDataTest() {
|
|||
asize = sizeof(s5)/sizeof(s[0]);
|
||||
h = filterInitMergeRange(TSDB_DATA_TYPE_BIGINT, 0);
|
||||
for (int32_t i = 0; i < asize; ++i) {
|
||||
filterAddMergeRange(h, s + i, e + i, TSDB_RELATION_AND);
|
||||
ra.s = s[i];
|
||||
ra.e = e[i];
|
||||
|
||||
filterAddMergeRange(h, &ra, TSDB_RELATION_AND);
|
||||
}
|
||||
filterGetMergeRangeNum(h, &num);
|
||||
ASSERT_EQ(num, 0);
|
||||
|
@ -214,7 +261,10 @@ void intDataTest() {
|
|||
|
||||
h = filterInitMergeRange(TSDB_DATA_TYPE_BIGINT, 0);
|
||||
for (int32_t i = 0; i < asize; ++i) {
|
||||
filterAddMergeRange(h, s + i, e + i, TSDB_RELATION_OR);
|
||||
ra.s = s[i];
|
||||
ra.e = e[i];
|
||||
|
||||
filterAddMergeRange(h, &ra, TSDB_RELATION_OR);
|
||||
}
|
||||
filterGetMergeRangeNum(h, &num);
|
||||
ASSERT_EQ(num, 2);
|
||||
|
@ -228,7 +278,10 @@ void intDataTest() {
|
|||
|
||||
h = filterInitMergeRange(TSDB_DATA_TYPE_BIGINT, 0);
|
||||
for (int32_t i = 0; i < asize; ++i) {
|
||||
filterAddMergeRange(h, s + i, e + i, (i == (asize -1)) ? TSDB_RELATION_AND : TSDB_RELATION_OR);
|
||||
ra.s = s[i];
|
||||
ra.e = e[i];
|
||||
|
||||
filterAddMergeRange(h, &ra, (i == (asize -1)) ? TSDB_RELATION_AND : TSDB_RELATION_OR);
|
||||
}
|
||||
filterGetMergeRangeNum(h, &num);
|
||||
ASSERT_EQ(num, 1);
|
||||
|
|
Loading…
Reference in New Issue