enh:[TD-31548] Remove ASSERT in multi files.
This commit is contained in:
parent
456f0d888a
commit
726f41697d
|
@ -332,6 +332,10 @@ static int tagIdxKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kL
|
|||
} else if (!pTagIdxKey1->isNull && !pTagIdxKey2->isNull) {
|
||||
// all not NULL, compr tag vals
|
||||
__compar_fn_t func = getComparFunc(pTagIdxKey1->type, 0);
|
||||
if (func == NULL) {
|
||||
metaError("meta/open: %s", terrstr());
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
c = func(pTagIdxKey1->data, pTagIdxKey2->data);
|
||||
if (c) return c;
|
||||
}
|
||||
|
|
|
@ -1103,7 +1103,12 @@ int32_t metaFilterCreateTime(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
|
|||
SBtimeIdxKey *p = entryKey;
|
||||
if (count > TRY_ERROR_LIMIT) break;
|
||||
|
||||
terrno = TSDB_CODE_SUCCESS;
|
||||
int32_t cmp = (*param->filterFunc)((void *)&p->btime, (void *)&pBtimeKey->btime, param->type);
|
||||
if (terrno != TSDB_CODE_SUCCESS) {
|
||||
ret = terrno;
|
||||
break;
|
||||
}
|
||||
if (cmp == 0) {
|
||||
if (taosArrayPush(pUids, &p->uid) == NULL) {
|
||||
ret = terrno;
|
||||
|
@ -1167,7 +1172,12 @@ int32_t metaFilterTableName(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
|
|||
if (count > TRY_ERROR_LIMIT) break;
|
||||
|
||||
char *pTableKey = (char *)pEntryKey;
|
||||
terrno = TSDB_CODE_SUCCESS;
|
||||
cmp = (*param->filterFunc)(pTableKey, pName, pCursor->type);
|
||||
if (terrno != TSDB_CODE_SUCCESS) {
|
||||
ret = terrno;
|
||||
goto END;
|
||||
}
|
||||
if (cmp == 0) {
|
||||
tb_uid_t tuid = *(tb_uid_t *)pEntryVal;
|
||||
if (taosArrayPush(pUids, &tuid) == NULL) {
|
||||
|
@ -1361,7 +1371,12 @@ int32_t metaFilterTableIds(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
|
|||
}
|
||||
}
|
||||
|
||||
terrno = TSDB_CODE_SUCCESS;
|
||||
int32_t cmp = (*param->filterFunc)(p->data, pKey->data, pKey->type);
|
||||
if (terrno != TSDB_CODE_SUCCESS) {
|
||||
TAOS_CHECK_GOTO(terrno, NULL, END);
|
||||
break;
|
||||
}
|
||||
if (cmp == 0) {
|
||||
// match
|
||||
tb_uid_t tuid = 0;
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#define VNODE_GET_LOAD_RESET_VALS(pVar, oVal, vType, tags) \
|
||||
do { \
|
||||
int##vType##_t newVal = atomic_sub_fetch_##vType(&(pVar), (oVal)); \
|
||||
ASSERT(newVal >= 0); \
|
||||
if (newVal < 0) { \
|
||||
vWarn("vgId:%d, %s, abnormal val:%" PRIi64 ", old val:%" PRIi64, TD_VID(pVnode), tags, newVal, (oVal)); \
|
||||
} \
|
||||
|
@ -37,7 +36,10 @@ int32_t fillTableColCmpr(SMetaReader *reader, SSchemaExt *pExt, int32_t numOfCol
|
|||
int8_t tblType = reader->me.type;
|
||||
if (useCompress(tblType)) {
|
||||
SColCmprWrapper *p = &(reader->me.colCmpr);
|
||||
ASSERT(numOfCol == p->nCols);
|
||||
if (numOfCol != p->nCols) {
|
||||
vError("fillTableColCmpr table type:%d, col num:%d, col cmpr num:%d mismatch", tblType, numOfCol, p->nCols);
|
||||
return TSDB_CODE_APP_ERROR;
|
||||
}
|
||||
for (int i = 0; i < p->nCols; i++) {
|
||||
SColCmpr *pCmpr = &p->pColCmpr[i];
|
||||
pExt[i].colId = pCmpr->id;
|
||||
|
@ -104,7 +106,8 @@ int32_t vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
|||
} else if (mer1.me.type == TSDB_NORMAL_TABLE) {
|
||||
schema = mer1.me.ntbEntry.schemaRow;
|
||||
} else {
|
||||
ASSERT(0);
|
||||
vError("vnodeGetTableMeta get invalid table type:%d", mer1.me.type);
|
||||
return TSDB_CODE_APP_ERROR;
|
||||
}
|
||||
|
||||
metaRsp.numOfTags = schemaTag.nCols;
|
||||
|
@ -262,7 +265,8 @@ int32_t vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
ASSERT(0);
|
||||
vError("vnodeGetTableCfg get invalid table type:%d", mer1.me.type);
|
||||
return TSDB_CODE_APP_ERROR;
|
||||
}
|
||||
|
||||
cfgRsp.numOfTags = schemaTag.nCols;
|
||||
|
|
|
@ -2592,6 +2592,7 @@ static int32_t doBlockDataPrimaryKeyFilter(SSDataBlock* pBlock, STqOffsetVal* of
|
|||
TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR);
|
||||
|
||||
__compar_fn_t func = getComparFunc(pColPk->info.type, 0);
|
||||
QUERY_CHECK_NULL(func, code, lino, _end, terrno);
|
||||
for (int32_t i = 0; i < pBlock->info.rows; ++i) {
|
||||
int64_t* ts = (int64_t*)colDataGetData(pColTs, i);
|
||||
void* data = colDataGetData(pColPk, i);
|
||||
|
|
|
@ -343,27 +343,45 @@ int optSysDoCompare(__compar_fn_t func, int8_t comparType, void* a, void* b) {
|
|||
|
||||
static int optSysFilterFuncImpl__LowerThan(void* a, void* b, int16_t dtype) {
|
||||
__compar_fn_t func = getComparFunc(dtype, 0);
|
||||
if (func == NULL) {
|
||||
return -1;
|
||||
}
|
||||
return optSysDoCompare(func, OP_TYPE_LOWER_THAN, a, b);
|
||||
}
|
||||
static int optSysFilterFuncImpl__LowerEqual(void* a, void* b, int16_t dtype) {
|
||||
__compar_fn_t func = getComparFunc(dtype, 0);
|
||||
if (func == NULL) {
|
||||
return -1;
|
||||
}
|
||||
return optSysDoCompare(func, OP_TYPE_LOWER_EQUAL, a, b);
|
||||
}
|
||||
static int optSysFilterFuncImpl__GreaterThan(void* a, void* b, int16_t dtype) {
|
||||
__compar_fn_t func = getComparFunc(dtype, 0);
|
||||
if (func == NULL) {
|
||||
return -1;
|
||||
}
|
||||
return optSysDoCompare(func, OP_TYPE_GREATER_THAN, a, b);
|
||||
}
|
||||
static int optSysFilterFuncImpl__GreaterEqual(void* a, void* b, int16_t dtype) {
|
||||
__compar_fn_t func = getComparFunc(dtype, 0);
|
||||
if (func == NULL) {
|
||||
return -1;
|
||||
}
|
||||
return optSysDoCompare(func, OP_TYPE_GREATER_EQUAL, a, b);
|
||||
}
|
||||
static int optSysFilterFuncImpl__Equal(void* a, void* b, int16_t dtype) {
|
||||
__compar_fn_t func = getComparFunc(dtype, 0);
|
||||
if (func == NULL) {
|
||||
return -1;
|
||||
}
|
||||
return optSysDoCompare(func, OP_TYPE_EQUAL, a, b);
|
||||
}
|
||||
|
||||
static int optSysFilterFuncImpl__NoEqual(void* a, void* b, int16_t dtype) {
|
||||
__compar_fn_t func = getComparFunc(dtype, 0);
|
||||
if (func == NULL) {
|
||||
return -1;
|
||||
}
|
||||
return optSysDoCompare(func, OP_TYPE_NOT_EQUAL, a, b);
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ int32_t tfileWriterOpen(char* path, uint64_t suid, int64_t version, const char*
|
|||
void tfileWriterClose(TFileWriter* tw);
|
||||
int32_t tfileWriterCreate(IFileCtx* ctx, TFileHeader* header, TFileWriter** pWriter);
|
||||
void tfileWriterDestroy(TFileWriter* tw);
|
||||
int tfileWriterPut(TFileWriter* tw, void* data, bool order);
|
||||
int32_t tfileWriterPut(TFileWriter* tw, void* data, bool order);
|
||||
int tfileWriterFinish(TFileWriter* tw);
|
||||
|
||||
//
|
||||
|
|
|
@ -123,6 +123,7 @@ static int32_t cacheSearchCompareFunc(void* cache, SIndexTerm* term, SIdxTRslt*
|
|||
if (cache == NULL) {
|
||||
return 0;
|
||||
}
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
MemTable* mem = cache;
|
||||
IndexCache* pCache = mem->pCache;
|
||||
|
||||
|
@ -146,7 +147,12 @@ static int32_t cacheSearchCompareFunc(void* cache, SIndexTerm* term, SIdxTRslt*
|
|||
break;
|
||||
}
|
||||
CacheTerm* c = (CacheTerm*)SL_GET_NODE_DATA(node);
|
||||
terrno = TSDB_CODE_SUCCESS;
|
||||
TExeCond cond = cmpFn(c->colVal, pCt->colVal, pCt->colType);
|
||||
if (terrno != TSDB_CODE_SUCCESS) {
|
||||
code = terrno;
|
||||
goto _return;
|
||||
}
|
||||
if (cond == MATCH) {
|
||||
if (c->operaType == ADD_VALUE) {
|
||||
INDEX_MERGE_ADD_DEL(tr->del, tr->add, c->uid)
|
||||
|
@ -161,9 +167,11 @@ static int32_t cacheSearchCompareFunc(void* cache, SIndexTerm* term, SIdxTRslt*
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_return:
|
||||
taosMemoryFree(pCt);
|
||||
(void)tSkipListDestroyIter(iter);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
return code;
|
||||
}
|
||||
static int32_t cacheSearchLessThan(void* cache, SIndexTerm* term, SIdxTRslt* tr, STermValueType* s) {
|
||||
return cacheSearchCompareFunc(cache, term, tr, s, LT);
|
||||
|
@ -265,6 +273,7 @@ static int32_t cacheSearchCompareFunc_JSON(void* cache, SIndexTerm* term, SIdxTR
|
|||
}
|
||||
_cache_range_compare cmpFn = idxGetCompare(type);
|
||||
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
MemTable* mem = cache;
|
||||
IndexCache* pCache = mem->pCache;
|
||||
|
||||
|
@ -308,9 +317,18 @@ static int32_t cacheSearchCompareFunc_JSON(void* cache, SIndexTerm* term, SIdxTR
|
|||
continue;
|
||||
} else {
|
||||
char* p = taosMemoryCalloc(1, strlen(c->colVal) + 1);
|
||||
if (NULL == p) {
|
||||
code = terrno;
|
||||
goto _return;
|
||||
}
|
||||
memcpy(p, c->colVal, strlen(c->colVal));
|
||||
terrno = TSDB_CODE_SUCCESS;
|
||||
cond = cmpFn(p + skip, term->colVal, dType);
|
||||
taosMemoryFree(p);
|
||||
if (terrno != TSDB_CODE_SUCCESS) {
|
||||
code = terrno;
|
||||
goto _return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cond == MATCH) {
|
||||
|
@ -327,11 +345,12 @@ static int32_t cacheSearchCompareFunc_JSON(void* cache, SIndexTerm* term, SIdxTR
|
|||
}
|
||||
}
|
||||
|
||||
_return:
|
||||
taosMemoryFree(pCt);
|
||||
taosMemoryFree(exBuf);
|
||||
(void)tSkipListDestroyIter(iter);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
return code;
|
||||
}
|
||||
static int32_t cacheSearchRange(void* cache, SIndexTerm* term, SIdxTRslt* tr, STermValueType* s) {
|
||||
// impl later
|
||||
|
|
|
@ -84,27 +84,45 @@ __compar_fn_t idxGetCompar(int8_t type) {
|
|||
}
|
||||
static FORCE_INLINE TExeCond tCompareLessThan(void* a, void* b, int8_t type) {
|
||||
__compar_fn_t func = idxGetCompar(type);
|
||||
if (func == NULL) {
|
||||
return BREAK;
|
||||
}
|
||||
return tCompare(func, QUERY_LESS_THAN, a, b, type);
|
||||
}
|
||||
static FORCE_INLINE TExeCond tCompareLessEqual(void* a, void* b, int8_t type) {
|
||||
__compar_fn_t func = idxGetCompar(type);
|
||||
if (func == NULL) {
|
||||
return BREAK;
|
||||
}
|
||||
return tCompare(func, QUERY_LESS_EQUAL, a, b, type);
|
||||
}
|
||||
static FORCE_INLINE TExeCond tCompareGreaterThan(void* a, void* b, int8_t type) {
|
||||
__compar_fn_t func = idxGetCompar(type);
|
||||
if (func == NULL) {
|
||||
return BREAK;
|
||||
}
|
||||
return tCompare(func, QUERY_GREATER_THAN, a, b, type);
|
||||
}
|
||||
static FORCE_INLINE TExeCond tCompareGreaterEqual(void* a, void* b, int8_t type) {
|
||||
__compar_fn_t func = idxGetCompar(type);
|
||||
if (func == NULL) {
|
||||
return BREAK;
|
||||
}
|
||||
return tCompare(func, QUERY_GREATER_EQUAL, a, b, type);
|
||||
}
|
||||
|
||||
static FORCE_INLINE TExeCond tCompareContains(void* a, void* b, int8_t type) {
|
||||
__compar_fn_t func = idxGetCompar(type);
|
||||
if (func == NULL) {
|
||||
return BREAK;
|
||||
}
|
||||
return tCompare(func, QUERY_TERM, a, b, type);
|
||||
}
|
||||
static FORCE_INLINE TExeCond tCompareEqual(void* a, void* b, int8_t type) {
|
||||
__compar_fn_t func = idxGetCompar(type);
|
||||
if (func == NULL) {
|
||||
return BREAK;
|
||||
}
|
||||
return tCompare(func, QUERY_TERM, a, b, type);
|
||||
}
|
||||
TExeCond tCompare(__compar_fn_t func, int8_t cmptype, void* a, void* b, int8_t dtype) {
|
||||
|
|
|
@ -432,22 +432,37 @@ typedef int (*FilterFunc)(void *a, void *b, int16_t dtype);
|
|||
|
||||
static FORCE_INLINE int sifGreaterThan(void *a, void *b, int16_t dtype) {
|
||||
__compar_fn_t func = getComparFunc(dtype, 0);
|
||||
if (func == NULL) {
|
||||
return -1;
|
||||
}
|
||||
return tDoCompare(func, QUERY_GREATER_THAN, a, b);
|
||||
}
|
||||
static FORCE_INLINE int sifGreaterEqual(void *a, void *b, int16_t dtype) {
|
||||
__compar_fn_t func = getComparFunc(dtype, 0);
|
||||
if (func == NULL) {
|
||||
return -1;
|
||||
}
|
||||
return tDoCompare(func, QUERY_GREATER_EQUAL, a, b);
|
||||
}
|
||||
static FORCE_INLINE int sifLessEqual(void *a, void *b, int16_t dtype) {
|
||||
__compar_fn_t func = getComparFunc(dtype, 0);
|
||||
if (func == NULL) {
|
||||
return -1;
|
||||
}
|
||||
return tDoCompare(func, QUERY_LESS_EQUAL, a, b);
|
||||
}
|
||||
static FORCE_INLINE int sifLessThan(void *a, void *b, int16_t dtype) {
|
||||
__compar_fn_t func = getComparFunc(dtype, 0);
|
||||
if (func == NULL) {
|
||||
return -1;
|
||||
}
|
||||
return (int)tDoCompare(func, QUERY_LESS_THAN, a, b);
|
||||
}
|
||||
static FORCE_INLINE int sifEqual(void *a, void *b, int16_t dtype) {
|
||||
__compar_fn_t func = getComparFunc(dtype, 0);
|
||||
if (func == NULL) {
|
||||
return -1;
|
||||
}
|
||||
//__compar_fn_t func = idxGetCompar(dtype);
|
||||
return (int)tDoCompare(func, QUERY_TERM, a, b);
|
||||
}
|
||||
|
|
|
@ -315,7 +315,7 @@ static int32_t tfSearchRegex(void* reader, SIndexTerm* tem, SIdxTRslt* tr) {
|
|||
}
|
||||
|
||||
static int32_t tfSearchCompareFunc(void* reader, SIndexTerm* tem, SIdxTRslt* tr, RangeType type) {
|
||||
int ret = 0;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
char* p = tem->colVal;
|
||||
int skip = 0;
|
||||
_cache_range_compare cmpFn = idxGetCompare(type);
|
||||
|
@ -335,7 +335,13 @@ static int32_t tfSearchCompareFunc(void* reader, SIndexTerm* tem, SIdxTRslt* tr,
|
|||
FstSlice* s = &rt->data;
|
||||
char* ch = (char*)fstSliceData(s, NULL);
|
||||
|
||||
terrno = TSDB_CODE_SUCCESS;
|
||||
TExeCond cond = cmpFn(ch, p, tem->colType);
|
||||
if (TSDB_CODE_SUCCESS != terrno) {
|
||||
swsResultDestroy(rt);
|
||||
code = terrno;
|
||||
goto _return;
|
||||
}
|
||||
if (MATCH == cond) {
|
||||
(void)tfileReaderLoadTableIds((TFileReader*)reader, rt->out.out, tr->total);
|
||||
} else if (CONTINUE == cond) {
|
||||
|
@ -345,10 +351,11 @@ static int32_t tfSearchCompareFunc(void* reader, SIndexTerm* tem, SIdxTRslt* tr,
|
|||
}
|
||||
swsResultDestroy(rt);
|
||||
}
|
||||
_return:
|
||||
stmStDestroy(st);
|
||||
stmBuilderDestroy(sb);
|
||||
taosArrayDestroy(offsets);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
return code;
|
||||
}
|
||||
static int32_t tfSearchLessThan(void* reader, SIndexTerm* tem, SIdxTRslt* tr) {
|
||||
return tfSearchCompareFunc(reader, tem, tr, LT);
|
||||
|
@ -427,8 +434,8 @@ static int32_t tfSearchRange_JSON(void* reader, SIndexTerm* tem, SIdxTRslt* tr)
|
|||
}
|
||||
|
||||
static int32_t tfSearchCompareFunc_JSON(void* reader, SIndexTerm* tem, SIdxTRslt* tr, RangeType ctype) {
|
||||
int ret = 0;
|
||||
int skip = 0;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int skip = 0;
|
||||
|
||||
char* p = NULL;
|
||||
if (ctype == CONTAINS) {
|
||||
|
@ -469,9 +476,20 @@ static int32_t tfSearchCompareFunc_JSON(void* reader, SIndexTerm* tem, SIdxTRslt
|
|||
continue;
|
||||
}
|
||||
char* tBuf = taosMemoryCalloc(1, sz + 1);
|
||||
if (NULL == tBuf) {
|
||||
swsResultDestroy(rt);
|
||||
code = terrno;
|
||||
goto _return;
|
||||
}
|
||||
memcpy(tBuf, ch, sz);
|
||||
terrno = TSDB_CODE_SUCCESS;
|
||||
cond = cmpFn(tBuf + skip, tem->colVal, IDX_TYPE_GET_TYPE(tem->colType));
|
||||
taosMemoryFree(tBuf);
|
||||
if (TSDB_CODE_SUCCESS != terrno) {
|
||||
swsResultDestroy(rt);
|
||||
code = terrno;
|
||||
goto _return;
|
||||
}
|
||||
}
|
||||
if (MATCH == cond) {
|
||||
(void)tfileReaderLoadTableIds((TFileReader*)reader, rt->out.out, tr->total);
|
||||
|
@ -482,12 +500,14 @@ static int32_t tfSearchCompareFunc_JSON(void* reader, SIndexTerm* tem, SIdxTRslt
|
|||
}
|
||||
swsResultDestroy(rt);
|
||||
}
|
||||
|
||||
_return:
|
||||
stmStDestroy(st);
|
||||
stmBuilderDestroy(sb);
|
||||
taosArrayDestroy(offsets);
|
||||
taosMemoryFree(p);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
return code;
|
||||
}
|
||||
int tfileReaderSearch(TFileReader* reader, SIndexTermQuery* query, SIdxTRslt* tr) {
|
||||
int ret = 0;
|
||||
|
@ -558,7 +578,7 @@ int32_t tfileWriterCreate(IFileCtx* ctx, TFileHeader* header, TFileWriter** pWri
|
|||
return code;
|
||||
}
|
||||
|
||||
int tfileWriterPut(TFileWriter* tw, void* data, bool order) {
|
||||
int32_t tfileWriterPut(TFileWriter* tw, void* data, bool order) {
|
||||
// sort by coltype and write to tindex
|
||||
if (order == false) {
|
||||
__compar_fn_t fn;
|
||||
|
@ -571,6 +591,9 @@ int tfileWriterPut(TFileWriter* tw, void* data, bool order) {
|
|||
} else {
|
||||
fn = getComparFunc(colType, 0);
|
||||
}
|
||||
if (fn == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
(void)taosArraySortPWithExt((SArray*)(data), tfileValueCompare, &fn);
|
||||
}
|
||||
|
||||
|
|
|
@ -521,6 +521,10 @@ int32_t filterInitRangeCtx(int32_t type, int32_t options, SFilterRangeCtx **ctx)
|
|||
(*ctx)->type = type;
|
||||
(*ctx)->options = options;
|
||||
(*ctx)->pCompareFunc = getComparFunc(type, 0);
|
||||
if ((*ctx)->pCompareFunc == NULL) {
|
||||
taosMemoryFree(*ctx);
|
||||
return terrno;
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -556,6 +560,9 @@ int32_t filterReuseRangeCtx(SFilterRangeCtx *ctx, int32_t type, int32_t options)
|
|||
ctx->options = options;
|
||||
ctx->pCompareFunc = getComparFunc(type, 0);
|
||||
|
||||
if (ctx->pCompareFunc == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1454,6 +1461,9 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan
|
|||
|
||||
if ((!FILTER_GET_FLAG(ra->sflag, RANGE_FLG_NULL)) && (!FILTER_GET_FLAG(ra->eflag, RANGE_FLG_NULL))) {
|
||||
__compar_fn_t func = getComparFunc(type, 0);
|
||||
if (func == NULL) {
|
||||
FLT_ERR_RET(terrno);
|
||||
}
|
||||
if (func(&ra->s, &ra->e) == 0) {
|
||||
void *data = taosMemoryMalloc(sizeof(int64_t));
|
||||
if (data == NULL) {
|
||||
|
@ -1565,6 +1575,9 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan
|
|||
|
||||
if ((!FILTER_GET_FLAG(r->ra.sflag, RANGE_FLG_NULL)) && (!FILTER_GET_FLAG(r->ra.eflag, RANGE_FLG_NULL))) {
|
||||
__compar_fn_t func = getComparFunc(type, 0);
|
||||
if (func == NULL) {
|
||||
FLT_ERR_RET(terrno);
|
||||
}
|
||||
if (func(&r->ra.s, &r->ra.e) == 0) {
|
||||
void *data = taosMemoryMalloc(sizeof(int64_t));
|
||||
if (data == NULL) {
|
||||
|
@ -2461,7 +2474,12 @@ int32_t filterMergeGroupUnits(SFilterInfo *info, SFilterGroupCtx **gRes, int32_t
|
|||
}
|
||||
|
||||
if (colIdxi > 1) {
|
||||
taosSort(colIdx, colIdxi, sizeof(uint32_t), getComparFunc(TSDB_DATA_TYPE_USMALLINT, 0));
|
||||
__compar_fn_t cmpFn = getComparFunc(TSDB_DATA_TYPE_USMALLINT, 0);
|
||||
if (cmpFn == NULL) {
|
||||
filterFreeGroupCtx(gRes[gResIdx]);
|
||||
FLT_ERR_JRET(terrno);
|
||||
}
|
||||
taosSort(colIdx, colIdxi, sizeof(uint32_t), cmpFn);
|
||||
}
|
||||
|
||||
for (uint32_t l = 0; l < colIdxi; ++l) {
|
||||
|
|
|
@ -267,7 +267,7 @@ int32_t compareJsonVal(const void *pLeft, const void *pRight) {
|
|||
} else if (leftType == TSDB_DATA_TYPE_NULL) {
|
||||
return 0;
|
||||
} else {
|
||||
ASSERTS(0, "data type unexpected");
|
||||
uError("data type unexpected leftType:%d rightType:%d", leftType, rightType);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -1497,7 +1497,9 @@ int32_t taosArrayCompareString(const void *a, const void *b) {
|
|||
int32_t comparestrPatternMatch(const void *pLeft, const void *pRight) {
|
||||
SPatternCompareInfo pInfo = PATTERN_COMPARE_INFO_INITIALIZER;
|
||||
|
||||
ASSERT(varDataTLen(pRight) <= TSDB_MAX_FIELD_LEN);
|
||||
if (varDataTLen(pRight) > TSDB_MAX_FIELD_LEN) {
|
||||
return 1;
|
||||
}
|
||||
size_t pLen = varDataLen(pRight);
|
||||
size_t sz = varDataLen(pLeft);
|
||||
|
||||
|
@ -1546,7 +1548,9 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) {
|
|||
case TSDB_DATA_TYPE_TIMESTAMP:
|
||||
return setChkInBytes8;
|
||||
default:
|
||||
ASSERTS(0, "data type unexpected");
|
||||
uError("getComparFunc data type unexpected type:%d, optr:%d", type, optr);
|
||||
terrno = TSDB_CODE_FUNC_FUNTION_PARA_TYPE;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1570,7 +1574,9 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) {
|
|||
case TSDB_DATA_TYPE_TIMESTAMP:
|
||||
return setChkNotInBytes8;
|
||||
default:
|
||||
ASSERTS(0, "data type unexpected");
|
||||
uError("getComparFunc data type unexpected type:%d, optr:%d", type, optr);
|
||||
terrno = TSDB_CODE_FUNC_FUNTION_PARA_TYPE;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -226,10 +226,12 @@ _hash_fn_t taosGetDefaultHashFunction(int32_t type) {
|
|||
}
|
||||
|
||||
int32_t taosFloatEqual(const void *a, const void *b, size_t UNUSED_PARAM(sz)) {
|
||||
// getComparFunc(TSDB_DATA_TYPE_FLOAT, -1) will always get function compareFloatVal, which will never be NULL.
|
||||
return getComparFunc(TSDB_DATA_TYPE_FLOAT, -1)(a, b);
|
||||
}
|
||||
|
||||
int32_t taosDoubleEqual(const void *a, const void *b, size_t UNUSED_PARAM(sz)) {
|
||||
// getComparFunc(TSDB_DATA_TYPE_DOUBLE, -1) will always get function compareDoubleVal, which will never be NULL.
|
||||
return getComparFunc(TSDB_DATA_TYPE_DOUBLE, -1)(a, b);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue