opti:logic for get table list
This commit is contained in:
parent
8be1396268
commit
4f03e2e4f5
|
@ -315,8 +315,6 @@ static EDealRes getColumn(SNode* pNode, void* pContext) {
|
||||||
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};
|
||||||
taosArrayPush(pData->cInfoList, &cInfo);
|
taosArrayPush(pData->cInfoList, &cInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DEAL_RES_END;
|
|
||||||
}
|
}
|
||||||
return DEAL_RES_CONTINUE;
|
return DEAL_RES_CONTINUE;
|
||||||
}
|
}
|
||||||
|
@ -388,34 +386,42 @@ SColumnInfoData* getColInfoResult(void* metaHandle, SArray* pTableList, SNode* p
|
||||||
for (int32_t i = 0; i < rows; i++) {
|
for (int32_t i = 0; i < rows; i++) {
|
||||||
STableKeyInfo* info = taosArrayGet(pTableList, i);
|
STableKeyInfo* info = taosArrayGet(pTableList, i);
|
||||||
|
|
||||||
|
// int64_t stt = taosGetTimestampUs();
|
||||||
SMetaReader mr = {0};
|
SMetaReader mr = {0};
|
||||||
metaReaderInit(&mr, metaHandle, 0);
|
metaReaderInit(&mr, metaHandle, 0);
|
||||||
code = metaGetTableEntryByUid(&mr, info->uid);
|
code = metaGetTableEntryByUid(&mr, info->uid);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
// int64_t stt1 = taosGetTimestampUs();
|
||||||
for(int32_t j = 0; j < taosArrayGetSize(pResBlock->pDataBlock); j++){
|
// qDebug("generate tag get meta rows:%d, cost:%ld ms", rows, stt1-stt);
|
||||||
SColumnInfoData* pColInfo = (SColumnInfoData*)taosArrayGet(pResBlock->pDataBlock, j);
|
|
||||||
STagVal tagVal = {0};
|
|
||||||
tagVal.cid = pColInfo->info.colId;
|
|
||||||
const char* p = metaGetTableTagVal(&mr.me, pColInfo->info.type, &tagVal);
|
|
||||||
|
|
||||||
if (IS_VAR_DATA_TYPE(pColInfo->info.type)) {
|
for(int32_t j = 0; j < taosArrayGetSize(pResBlock->pDataBlock); j++){
|
||||||
char* tmp = taosMemoryCalloc(tagVal.nData + VARSTR_HEADER_SIZE, 1);
|
SColumnInfoData* pColInfo = (SColumnInfoData*)taosArrayGet(pResBlock->pDataBlock, j);
|
||||||
memcpy(varDataVal(tmp), tagVal.pData, tagVal.nData);
|
STagVal tagVal = {0};
|
||||||
varDataSetLen(tmp, tagVal.nData);
|
tagVal.cid = pColInfo->info.colId;
|
||||||
colDataAppend(pColInfo, i, tmp, p == NULL);
|
// int64_t t1 = taosGetTimestampUs();
|
||||||
taosMemoryFree(tmp);
|
const char* p = metaGetTableTagVal(&mr.me, pColInfo->info.type, &tagVal);
|
||||||
} else {
|
// int64_t t2 = taosGetTimestampUs();
|
||||||
colDataAppend(pColInfo, i, p, p == NULL);
|
// qDebug("generate tag inner1 rows:%d, cost:%ld ms", rows, t2-t1);
|
||||||
}
|
|
||||||
|
if (p == NULL){
|
||||||
|
colDataAppend(pColInfo, i, p, true);
|
||||||
|
} else if (IS_VAR_DATA_TYPE(pColInfo->info.type)) {
|
||||||
|
char *tmp = (char*)(tagVal.pData - VARSTR_HEADER_SIZE);
|
||||||
|
varDataSetLen(tmp, tagVal.nData);
|
||||||
|
colDataAppend(pColInfo, i, tmp, p == NULL);
|
||||||
|
} else {
|
||||||
|
colDataAppend(pColInfo, i, p, false);
|
||||||
}
|
}
|
||||||
|
// int64_t t3 = taosGetTimestampUs();
|
||||||
|
// qDebug("generate tag inner2 rows:%d, cost:%ld ms", rows, t3-t2);
|
||||||
}
|
}
|
||||||
|
// int64_t stt2 = taosGetTimestampUs();
|
||||||
|
// qDebug("generate tag get block rows:%d, cost:%ld us", rows, stt2-stt1);
|
||||||
metaReaderClear(&mr);
|
metaReaderClear(&mr);
|
||||||
}
|
}
|
||||||
pResBlock->info.rows = rows;
|
pResBlock->info.rows = rows;
|
||||||
|
|
||||||
int64_t st1 = taosGetTimestampUs();
|
int64_t st1 = taosGetTimestampUs();
|
||||||
qDebug("generate tag block rows:%d, cost:%lf ms", rows, st1-st);
|
qDebug("generate tag block rows:%d, cost:%ld us", rows, st1-st);
|
||||||
|
|
||||||
pBlockList = taosArrayInit(2, POINTER_BYTES);
|
pBlockList = taosArrayInit(2, POINTER_BYTES);
|
||||||
taosArrayPush(pBlockList, &pResBlock);
|
taosArrayPush(pBlockList, &pResBlock);
|
||||||
|
@ -431,7 +437,7 @@ SColumnInfoData* getColInfoResult(void* metaHandle, SArray* pTableList, SNode* p
|
||||||
terrno = code;
|
terrno = code;
|
||||||
}
|
}
|
||||||
int64_t st2 = taosGetTimestampUs();
|
int64_t st2 = taosGetTimestampUs();
|
||||||
qDebug("calculate tag block rows:%d, cost:%lf ms", rows, st2-st1);
|
qDebug("calculate tag block rows:%d, cost:%ld us", rows, st2-st1);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
taosHashCleanup(ctx.colHash);
|
taosHashCleanup(ctx.colHash);
|
||||||
|
@ -489,7 +495,7 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
|
||||||
taosArrayPush(pListInfo->pTableList, &info);
|
taosArrayPush(pListInfo->pTableList, &info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pTagCond) {
|
if (pTagCond && taosArrayGetSize(pListInfo->pTableList) > 0) {
|
||||||
SColumnInfoData* pColInfoData = getColInfoResult(metaHandle, pListInfo->pTableList, pTagCond);
|
SColumnInfoData* pColInfoData = getColInfoResult(metaHandle, pListInfo->pTableList, pTagCond);
|
||||||
if(terrno != TDB_CODE_SUCCESS){
|
if(terrno != TDB_CODE_SUCCESS){
|
||||||
colDataDestroy(pColInfoData);
|
colDataDestroy(pColInfoData);
|
||||||
|
|
Loading…
Reference in New Issue