提交 06a73ccd 编写于 作者: wmmhello's avatar wmmhello

TD-6129<feature> add json type check

上级 a5098706
...@@ -1112,9 +1112,9 @@ static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable, bool refSuper ...@@ -1112,9 +1112,9 @@ static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable, bool refSuper
continue; continue;
} }
void* tablist = taosHashGet(pSTable->jsonKeyMap, varDataVal(val), varDataLen(val)); SArray** tablist = (SArray**)taosHashGet(pSTable->jsonKeyMap, varDataVal(val), varDataLen(val));
if(tablist == NULL) { if(tablist == NULL) {
void* tablistNew = taosArrayInit(8, sizeof(JsonMapValue)); SArray* tablistNew = taosArrayInit(8, sizeof(JsonMapValue));
if(tablistNew == NULL){ if(tablistNew == NULL){
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
tsdbError("out of memory when alloc json tag array"); tsdbError("out of memory when alloc json tag array");
...@@ -1125,14 +1125,14 @@ static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable, bool refSuper ...@@ -1125,14 +1125,14 @@ static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable, bool refSuper
tsdbError("out of memory when put json tag array"); tsdbError("out of memory when put json tag array");
return -1; return -1;
} }
tablist = tablistNew; tablist = &tablistNew;
} }
JsonMapValue jmvalue = {pTable, pColIdx->colId}; JsonMapValue jmvalue = {pTable, pColIdx->colId};
void* p = taosArraySearch(tablist, &jmvalue, tscCompareJsonMapValue, TD_EQ); void* p = taosArraySearch(*tablist, &jmvalue, tscCompareJsonMapValue, TD_EQ);
if (p == NULL) { if (p == NULL) {
taosArrayPush(tablist, &jmvalue); taosArrayPush(*tablist, &jmvalue);
}else{ }else{
taosArrayInsert(tablist, TARRAY_ELEM_IDX((SArray*)tablist, p), &jmvalue); taosArrayInsert(*tablist, TARRAY_ELEM_IDX((SArray*)*tablist, p), &jmvalue);
} }
} }
}else{ }else{
...@@ -1163,19 +1163,19 @@ static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable) { ...@@ -1163,19 +1163,19 @@ static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable) {
continue; continue;
} }
void* tablist = taosHashGet(pSTable->jsonKeyMap, varDataVal(val) ,varDataLen(val)); SArray** tablist = (SArray **)taosHashGet(pSTable->jsonKeyMap, varDataVal(val) ,varDataLen(val));
if(tablist == NULL) { if(tablist == NULL) {
tsdbError("json tag no key error,%d", j); tsdbError("json tag no key error,%d", j);
continue; continue;
} }
JsonMapValue jmvalue = {pTable, pColIdx->colId}; JsonMapValue jmvalue = {pTable, pColIdx->colId};
void* p = taosArraySearch(tablist, &jmvalue, tscCompareJsonMapValue, TD_EQ); void* p = taosArraySearch(*tablist, &jmvalue, tscCompareJsonMapValue, TD_EQ);
if (p == NULL) { if (p == NULL) {
tsdbError("json tag no tableid error,%d", j); tsdbError("json tag no tableid error,%d", j);
continue; continue;
} }
taosArrayRemove(tablist, TARRAY_ELEM_IDX((SArray*)tablist, p)); taosArrayRemove(*tablist, TARRAY_ELEM_IDX((SArray*)*tablist, p));
} }
}else { }else {
char * key = getTagIndexKey(pTable); char * key = getTagIndexKey(pTable);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册