diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index ade3b7a8e886bf1692390eb2851d13df158b84ca..25e8d59a22bee9ecf283e5f479e3944f9df1c95a 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);