From 2a696d2790f1a0b0da6cb6df89d5a5ce14b28a42 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 29 Apr 2022 08:49:31 +0800 Subject: [PATCH] fix(query): add one more attribute in SSDataBlock. --- include/common/tcommon.h | 14 ++++++-------- include/libs/function/function.h | 2 +- source/libs/executor/src/scanoperator.c | 8 -------- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/include/common/tcommon.h b/include/common/tcommon.h index fa428a994a..09a821ef06 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -65,14 +65,12 @@ typedef struct SDataBlockInfo { STimeWindow window; int32_t rows; int32_t rowSize; - union { - int64_t uid; // from which table of uid, comes from this data block - int64_t blockId; - }; - uint64_t groupId; // no need to serialize - int16_t numOfCols; - int16_t hasVarCol; - int16_t capacity; + int64_t uid; // the uid of table, from which current data block comes + int64_t blockId; // block id, generated by physical planner + uint64_t groupId; // no need to serialize + int16_t numOfCols; + int16_t hasVarCol; + int16_t capacity; } SDataBlockInfo; typedef struct SSDataBlock { diff --git a/include/libs/function/function.h b/include/libs/function/function.h index 094ce80106..347303a051 100644 --- a/include/libs/function/function.h +++ b/include/libs/function/function.h @@ -165,7 +165,7 @@ typedef struct SInputColumnInfoData { SColumnInfoData *pPTS; // primary timestamp column SColumnInfoData **pData; SColumnDataAgg **pColumnDataAgg; - uint64_t uid; // table uid + uint64_t uid; // table uid, used to set the tag value when building the final query result for selectivity functions. } SInputColumnInfoData; // sql function runtime context diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index f553af7995..dc87b864f1 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -184,8 +184,6 @@ int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableScanInfo, qDebug("%s data block skipped, brange:%" PRId64 "-%" PRId64 ", rows:%d", GET_TASKID(pTaskInfo), pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows); pCost->skipBlocks += 1; - - pBlock->info.blockId = 0; return TSDB_CODE_SUCCESS; } else if (*status == FUNC_DATA_REQUIRED_STATIS_LOAD) { pCost->loadBlockStatis += 1; @@ -206,7 +204,6 @@ int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableScanInfo, pBlock->pBlockAgg[pColMatchInfo->targetSlotId] = pColAgg[i]; } - pBlock->info.blockId = 0; return TSDB_CODE_SUCCESS; } else { // failed to load the block sma data, data block statistics does not exist, load data block instead *status = FUNC_DATA_REQUIRED_DATA_LOAD; @@ -235,11 +232,6 @@ int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableScanInfo, } relocateColumnData(pBlock, pTableScanInfo->pColMatchInfo, pCols); - - // reset the block to be 0 by default, this blockId is assigned by physical plan and is used by direct upstream - // operator. - pBlock->info.blockId = 0; - doFilter(pTableScanInfo->pFilterNode, pBlock); if (pBlock->info.rows == 0) { pCost->filterOutBlocks += 1;