From 1f746769540fed4aae093693f0a5937f336b8199 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 4 Jul 2022 15:41:36 +0800 Subject: [PATCH] refactor index --- source/libs/executor/src/executil.c | 16 ++++++++-------- source/libs/index/src/indexFilter.c | 8 +------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 24eae225bf..d78ee2ac5a 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -63,7 +63,8 @@ size_t getResultRowSize(SqlFunctionCtx* pCtx, int32_t numOfOutput) { rowSize += pCtx[i].resDataInfo.interBufSize; } - rowSize += (numOfOutput * sizeof(bool)); // expand rowSize to mark if col is null for top/bottom result(saveTupleData) + rowSize += + (numOfOutput * sizeof(bool)); // expand rowSize to mark if col is null for top/bottom result(saveTupleData) return rowSize; } @@ -114,7 +115,7 @@ void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SHashObj* pHashmap, int p->pos = *(SResultRowPosition*)pData; memcpy(p->key, (char*)key + sizeof(uint64_t), keyLen - sizeof(uint64_t)); #ifdef BUF_PAGE_DEBUG - qDebug("page_groupRes, groupId:%"PRIu64",pageId:%d,offset:%d\n", p->groupId, p->pos.pageId, p->pos.offset); + qDebug("page_groupRes, groupId:%" PRIu64 ",pageId:%d,offset:%d\n", p->groupId, p->pos.pageId, p->pos.offset); #endif taosArrayPush(pGroupResInfo->pRows, &p); } @@ -305,8 +306,7 @@ int32_t getTableList(void* metaHandle, SScanPhysiNode* pScanNode, STableListInfo .metaEx = metaHandle, .idx = tsdbGetIdx(metaHandle), .ivtIdx = tsdbGetIvtIdx(metaHandle), .suid = tableUid}; SArray* res = taosArrayInit(8, sizeof(uint64_t)); - // code = doFilterTag(pTagIndexCond, &metaArg, res); - code = TSDB_CODE_INDEX_REBUILDING; + code = doFilterTag(pTagIndexCond, &metaArg, res); if (code == TSDB_CODE_INDEX_REBUILDING) { code = tsdbGetAllTableList(metaHandle, tableUid, pListInfo->pTableList); } else if (code != TSDB_CODE_SUCCESS) { @@ -333,13 +333,13 @@ int32_t getTableList(void* metaHandle, SScanPhysiNode* pScanNode, STableListInfo return code; } - if(pTagCond){ + if (pTagCond) { int32_t i = 0; while (i < taosArrayGetSize(pListInfo->pTableList)) { STableKeyInfo* info = taosArrayGet(pListInfo->pTableList, i); - bool isOk = isTableOk(info, pTagCond, metaHandle); - if(terrno) return terrno; - if(!isOk){ + bool isOk = isTableOk(info, pTagCond, metaHandle); + if (terrno) return terrno; + if (!isOk) { taosArrayRemove(pListInfo->pTableList, i); continue; } diff --git a/source/libs/index/src/indexFilter.c b/source/libs/index/src/indexFilter.c index 90aafb1097..0534bd6f24 100644 --- a/source/libs/index/src/indexFilter.c +++ b/source/libs/index/src/indexFilter.c @@ -743,17 +743,14 @@ int32_t doFilterTag(const SNode *pFilterNode, SIndexMetaArg *metaArg, SArray *re } SFilterInfo *filter = NULL; - // todo move to the initialization function - // SIF_ERR_RET(filterInitFromNode((SNode *)pFilterNode, &filter, 0)); SArray * output = taosArrayInit(8, sizeof(uint64_t)); SIFParam param = {.arg = *metaArg, .result = output}; SIF_ERR_RET(sifCalculate((SNode *)pFilterNode, ¶m)); taosArrayAddAll(result, param.result); - // taosArrayAddAll(result, param.result); sifFreeParam(¶m); - SIF_RET(TSDB_CODE_SUCCESS); + return TSDB_CODE_SUCCESS; } SIdxFltStatus idxGetFltStatus(SNode *pFilterNode) { @@ -761,9 +758,6 @@ SIdxFltStatus idxGetFltStatus(SNode *pFilterNode) { if (pFilterNode == NULL) { return SFLT_NOT_INDEX; } - // SFilterInfo *filter = NULL; - // todo move to the initialization function - // SIF_ERR_RET(filterInitFromNode((SNode *)pFilterNode, &filter, 0)); SIF_ERR_RET(sifGetFltHint((SNode *)pFilterNode, &st)); return st;