fea:add select json logic

This commit is contained in:
wangmm0220 2022-05-19 17:57:14 +08:00
parent 91dc9e9089
commit 6c26b6230f
3 changed files with 6 additions and 6 deletions

View File

@ -832,8 +832,7 @@ static char* parseTagDatatoJson(void *p){
goto end; goto end;
} }
cJSON_AddItemToObject(json, tagJsonKey, value); cJSON_AddItemToObject(json, tagJsonKey, value);
} }else{
else{
ASSERT(0); ASSERT(0);
} }

View File

@ -1467,7 +1467,6 @@ static SSDataBlock* doTagScan(SOperatorInfo* pOperator) {
STR_TO_VARSTR(str, mr.me.name); STR_TO_VARSTR(str, mr.me.name);
colDataAppend(pDst, count, str, false); colDataAppend(pDst, count, str, false);
} else { // it is a tag value } else { // it is a tag value
const char* p = NULL;
if(pDst->info.type == TSDB_DATA_TYPE_JSON){ if(pDst->info.type == TSDB_DATA_TYPE_JSON){
const uint8_t *tmp = mr.me.ctbEntry.pTags; const uint8_t *tmp = mr.me.ctbEntry.pTags;
char *data = taosMemoryCalloc(kvRowLen(tmp) + 1, 1); char *data = taosMemoryCalloc(kvRowLen(tmp) + 1, 1);
@ -1477,11 +1476,12 @@ static SSDataBlock* doTagScan(SOperatorInfo* pOperator) {
} }
*data = TSDB_DATA_TYPE_JSON; *data = TSDB_DATA_TYPE_JSON;
memcpy(data+1, tmp, kvRowLen(tmp)); memcpy(data+1, tmp, kvRowLen(tmp));
p = data; colDataAppend(pDst, count, data, false);
taosMemoryFree(data);
}else{ }else{
p = metaGetTableTagVal(&mr.me, pExprInfo[j].base.pParam[0].pCol->colId); const char* p = metaGetTableTagVal(&mr.me, pExprInfo[j].base.pParam[0].pCol->colId);
colDataAppend(pDst, count, p, (p == NULL));
} }
colDataAppend(pDst, count, p, (p == NULL));
} }
} }

View File

@ -923,6 +923,7 @@ static void doReleaseVec(SColumnInfoData* pCol, int32_t type) {
} }
char *getJsonValue(char *json, char *key){ char *getJsonValue(char *json, char *key){
json++; // jump type
int16_t cols = kvRowNCols(json); int16_t cols = kvRowNCols(json);
for (int i = 0; i < cols; ++i) { for (int i = 0; i < cols; ++i) {
SColIdx *pColIdx = kvRowColIdxAt(json, i); SColIdx *pColIdx = kvRowColIdxAt(json, i);