From 06a73ccd252fb05aceb7b6de33e4b18a3791de62 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 22 Sep 2021 01:03:02 +0800 Subject: [PATCH] TD-6129 add json type check --- src/tsdb/src/tsdbMeta.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index ade3b7a8e8..25e8d59a22 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -1112,9 +1112,9 @@ static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable, bool refSuper continue; } - void* tablist = taosHashGet(pSTable->jsonKeyMap, varDataVal(val), varDataLen(val)); + SArray** tablist = (SArray**)taosHashGet(pSTable->jsonKeyMap, varDataVal(val), varDataLen(val)); if(tablist == NULL) { - void* tablistNew = taosArrayInit(8, sizeof(JsonMapValue)); + SArray* tablistNew = taosArrayInit(8, sizeof(JsonMapValue)); if(tablistNew == NULL){ terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; tsdbError("out of memory when alloc json tag array"); @@ -1125,14 +1125,14 @@ static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable, bool refSuper tsdbError("out of memory when put json tag array"); return -1; } - tablist = tablistNew; + tablist = &tablistNew; } JsonMapValue jmvalue = {pTable, pColIdx->colId}; - void* p = taosArraySearch(tablist, &jmvalue, tscCompareJsonMapValue, TD_EQ); + void* p = taosArraySearch(*tablist, &jmvalue, tscCompareJsonMapValue, TD_EQ); if (p == NULL) { - taosArrayPush(tablist, &jmvalue); + taosArrayPush(*tablist, &jmvalue); }else{ - taosArrayInsert(tablist, TARRAY_ELEM_IDX((SArray*)tablist, p), &jmvalue); + taosArrayInsert(*tablist, TARRAY_ELEM_IDX((SArray*)*tablist, p), &jmvalue); } } }else{ @@ -1163,19 +1163,19 @@ static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable) { continue; } - void* tablist = taosHashGet(pSTable->jsonKeyMap, varDataVal(val) ,varDataLen(val)); + SArray** tablist = (SArray **)taosHashGet(pSTable->jsonKeyMap, varDataVal(val) ,varDataLen(val)); if(tablist == NULL) { tsdbError("json tag no key error,%d", j); continue; } JsonMapValue jmvalue = {pTable, pColIdx->colId}; - void* p = taosArraySearch(tablist, &jmvalue, tscCompareJsonMapValue, TD_EQ); + void* p = taosArraySearch(*tablist, &jmvalue, tscCompareJsonMapValue, TD_EQ); if (p == NULL) { tsdbError("json tag no tableid error,%d", j); continue; } - taosArrayRemove(tablist, TARRAY_ELEM_IDX((SArray*)tablist, p)); + taosArrayRemove(*tablist, TARRAY_ELEM_IDX((SArray*)*tablist, p)); } }else { char * key = getTagIndexKey(pTable); -- GitLab