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

fix:error in get table list by tag filter

上级 359fa4bc
...@@ -334,7 +334,13 @@ static EDealRes getColumn(SNode** pNode, void* pContext) { ...@@ -334,7 +334,13 @@ static EDealRes getColumn(SNode** pNode, void* pContext) {
taosHashPut(pData->colHash, &pSColumnNode->colId, sizeof(pSColumnNode->colId), pNode, sizeof((*pNode))); taosHashPut(pData->colHash, &pSColumnNode->colId, sizeof(pSColumnNode->colId), pNode, sizeof((*pNode)));
pSColumnNode->slotId = pData->index++; pSColumnNode->slotId = pData->index++;
SColumnInfo cInfo = {.colId = pSColumnNode->colId, .type = pSColumnNode->node.resType.type, .bytes = pSColumnNode->node.resType.bytes}; SColumnInfo cInfo = {.colId = pSColumnNode->colId, .type = pSColumnNode->node.resType.type, .bytes = pSColumnNode->node.resType.bytes};
#if TAG_FILTER_DEBUG
qDebug("tagfilter build column info, slotId:%d, colId:%d, type:%d", pSColumnNode->slotId, cInfo.colId, cInfo.type);
#endif
taosArrayPush(pData->cInfoList, &cInfo); taosArrayPush(pData->cInfoList, &cInfo);
}else{
SColumnNode* col = *(SColumnNode**)data;
pSColumnNode->slotId = col->slotId;
} }
return DEAL_RES_CONTINUE; return DEAL_RES_CONTINUE;
...@@ -431,7 +437,9 @@ static SColumnInfoData* getColInfoResult(void* metaHandle, uint64_t suid, SArray ...@@ -431,7 +437,9 @@ static SColumnInfoData* getColInfoResult(void* metaHandle, uint64_t suid, SArray
char str[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0}; char str[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
metaGetTableNameByUid(metaHandle, *uid, str); metaGetTableNameByUid(metaHandle, *uid, str);
colDataAppend(pColInfo, i, str, false); colDataAppend(pColInfo, i, str, false);
#if TAG_FILTER_DEBUG
qDebug("tagfilter uid:%ld, tbname:%s", *uid, str+2); qDebug("tagfilter uid:%ld, tbname:%s", *uid, str+2);
#endif
}else{ }else{
STagVal tagVal = {0}; STagVal tagVal = {0};
tagVal.cid = pColInfo->info.colId; tagVal.cid = pColInfo->info.colId;
...@@ -442,13 +450,23 @@ static SColumnInfoData* getColInfoResult(void* metaHandle, uint64_t suid, SArray ...@@ -442,13 +450,23 @@ static SColumnInfoData* getColInfoResult(void* metaHandle, uint64_t suid, SArray
} else if (pColInfo->info.type == TSDB_DATA_TYPE_JSON) { } else if (pColInfo->info.type == TSDB_DATA_TYPE_JSON) {
colDataAppend(pColInfo, i, p, false); colDataAppend(pColInfo, i, p, false);
} else if (IS_VAR_DATA_TYPE(pColInfo->info.type)) { } else if (IS_VAR_DATA_TYPE(pColInfo->info.type)) {
char *tmp = taosMemoryMalloc(tagVal.nData + VARSTR_HEADER_SIZE); char *tmp = taosMemoryCalloc(tagVal.nData + VARSTR_HEADER_SIZE + 1, 1);
varDataSetLen(tmp, tagVal.nData); varDataSetLen(tmp, tagVal.nData);
memcpy(tmp + VARSTR_HEADER_SIZE, tagVal.pData, tagVal.nData); memcpy(tmp + VARSTR_HEADER_SIZE, tagVal.pData, tagVal.nData);
colDataAppend(pColInfo, i, tmp, false); colDataAppend(pColInfo, i, tmp, false);
#if TAG_FILTER_DEBUG
qDebug("tagfilter varch:%s", tmp+2);
#endif
taosMemoryFree(tmp); taosMemoryFree(tmp);
} else { } else {
colDataAppend(pColInfo, i, (const char*)&tagVal.i64, false); colDataAppend(pColInfo, i, (const char*)&tagVal.i64, false);
#if TAG_FILTER_DEBUG
if(pColInfo->info.type == TSDB_DATA_TYPE_INT){
qDebug("tagfilter int:%d", *(int*)(&tagVal.i64));
}else if(pColInfo->info.type == TSDB_DATA_TYPE_DOUBLE){
qDebug("tagfilter double:%f", *(double *)(&tagVal.i64));
}
#endif
} }
} }
} }
......
...@@ -292,6 +292,9 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t ...@@ -292,6 +292,9 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t
} }
SColumnInfoData *columnData = (SColumnInfoData *)taosArrayGet(block->pDataBlock, ref->slotId); SColumnInfoData *columnData = (SColumnInfoData *)taosArrayGet(block->pDataBlock, ref->slotId);
#if TAG_FILTER_DEBUG
qDebug("tagfilter column info, slotId:%d, colId:%d, type:%d", ref->slotId, columnData->info.colId, columnData->info.type);
#endif
param->numOfRows = block->info.rows; param->numOfRows = block->info.rows;
param->columnData = columnData; param->columnData = columnData;
break; break;
......
...@@ -1672,8 +1672,8 @@ void vectorBitOr(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut, ...@@ -1672,8 +1672,8 @@ void vectorBitOr(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
colDataAppendInt8(pOut->columnData, i, (int8_t*)&result);\ colDataAppendInt8(pOut->columnData, i, (int8_t*)&result);\
}else{\ }else{\
bool res = filterDoCompare(fp, optr, pLeftData, pRightData);\ bool res = filterDoCompare(fp, optr, pLeftData, pRightData);\
colDataAppendInt8(pOut->columnData, i, (int8_t*)&res); \ colDataAppendInt8(pOut->columnData, i, (int8_t*)&res);\
} \ }\
if(freeLeft) taosMemoryFreeClear(pLeftData);\ if(freeLeft) taosMemoryFreeClear(pLeftData);\
if(freeRight) taosMemoryFreeClear(pRightData);\ if(freeRight) taosMemoryFreeClear(pRightData);\
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册