diff --git a/include/common/tcommon.h b/include/common/tcommon.h index ae873bbfa84664453c3d7736d6d5d626db58a923..1040130f769bd0d852663f0e19f85b32b4c26a06 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -65,14 +65,14 @@ typedef struct SDataBlockInfo { STimeWindow window; int32_t rows; int32_t rowSize; - int16_t numOfCols; - int16_t hasVarCol; - int16_t capacity; union { - int64_t uid; + 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; } SDataBlockInfo; typedef struct SSDataBlock { diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 78393b458239b52f94c82b9cccc2dc3794937569..f618c35dccb702dcf6e55ab52c88a139bc34fab5 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -3184,7 +3184,10 @@ void tsdbRetrieveDataBlockInfo(tsdbReaderT* pTsdbReadHandle, SDataBlockInfo* pDa uid = pCheckInfo->tableId; } - pDataBlockInfo->uid = uid; + tsdbDebug("data block generated, uid:%"PRIu64" numOfRows:%d, tsrange:%"PRId64" - %"PRId64" %s", uid, cur->rows, cur->win.skey, + cur->win.ekey, pHandle->idStr); + +// pDataBlockInfo->uid = uid; // block Id may be over write by assigning uid fro this data block. Do NOT assign the table uid pDataBlockInfo->rows = cur->rows; pDataBlockInfo->window = cur->win; pDataBlockInfo->numOfCols = (int32_t)(QH_GET_NUM_OF_COLS(pHandle)); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 3f7999b076d203d48a186c9d4849ac7dec02f841..b02efe46412b46e0564e0102d888b50cce1c2e10 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1270,7 +1270,7 @@ static void projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSData SColumnInfoData* pColInfoData = taosArrayGet(pResult->pDataBlock, k); colDataAssign(pColInfoData, pCtx[k].input.pData[0], pCtx[k].input.numOfRows); - pResult->info.rows = pCtx[0].input.numOfRows; + pResult->info.rows = pSrcBlock->info.rows; } else if (pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE) { SColumnInfoData* pColInfoData = taosArrayGet(pResult->pDataBlock, k); for (int32_t i = 0; i < pSrcBlock->info.rows; ++i) { diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 35191ccc8db96339e29dc273d735490521c96c8c..ba1f2dbd76369bf9558acf574b8f70f478450cf3 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -341,6 +341,7 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SExprInfo* pEx pOperator->pExpr = pExprInfo; pOperator->numOfOutput = numOfCols; pOperator->info = pInfo; + pOperator->pTaskInfo = pTaskInfo; pOperator->_openFn = operatorDummyOpenFn; pOperator->getNextFn = hashGroupbyAggregate; pOperator->closeFn = destroyGroupOperatorInfo; diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index 07358f905f46a46ef62d1ead474317ae8c57afbe..698c9312fcac85c45e85d027703c17a478544e3c 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -192,13 +192,23 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t } SColumnNode *ref = (SColumnNode *)node; - if (ref->dataBlockId >= taosArrayGetSize(ctx->pBlockList)) { + + int32_t index = -1; + for(int32_t i = 0; i < taosArrayGetSize(ctx->pBlockList); ++i) { + SSDataBlock* pb = taosArrayGetP(ctx->pBlockList, i); + if (pb->info.blockId == ref->dataBlockId) { + index = i; + break; + } + } + + if (index == -1) { sclError("column tupleId is too big, tupleId:%d, dataBlockNum:%d", ref->dataBlockId, (int32_t)taosArrayGetSize(ctx->pBlockList)); SCL_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); } - SSDataBlock *block = *(SSDataBlock **)taosArrayGet(ctx->pBlockList, ref->dataBlockId); - if (NULL == block || ref->slotId >= taosArrayGetSize(block->pDataBlock)) { + SSDataBlock *block = *(SSDataBlock **)taosArrayGet(ctx->pBlockList, index); + if (NULL == block || ref->slotId >= block->info.numOfCols) { sclError("column slotId is too big, slodId:%d, dataBlockSize:%d", ref->slotId, (int32_t)taosArrayGetSize(block->pDataBlock)); SCL_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); }