From 9ddff93b499109889fbe46391795ec2809210841 Mon Sep 17 00:00:00 2001 From: kailixu Date: Mon, 21 Nov 2022 22:51:26 +0800 Subject: [PATCH] feat: support 64k for row/column --- src/mnode/inc/mnodeDef.h | 8 ++++---- src/query/src/qAggMain.c | 14 +++++++------- src/query/src/qExecutor.c | 28 ++++++++++++++-------------- src/query/src/qPercentile.c | 4 ++-- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/mnode/inc/mnodeDef.h b/src/mnode/inc/mnodeDef.h index 3997a1155f..55d40fbce1 100644 --- a/src/mnode/inc/mnodeDef.h +++ b/src/mnode/inc/mnodeDef.h @@ -288,10 +288,10 @@ typedef struct { int32_t index; int32_t rowSize; int32_t numOfRows; - void * pIter; - void * pVgIter; - void ** ppShow; - int16_t offset[TSDB_MAX_COLUMNS]; + void *pIter; + void *pVgIter; + void **ppShow; + uint16_t offset[TSDB_MAX_COLUMNS]; int32_t bytes[TSDB_MAX_COLUMNS]; int32_t numOfReads; int8_t maxReplica; diff --git a/src/query/src/qAggMain.c b/src/query/src/qAggMain.c index 80926e1bb0..7aa2bc477c 100644 --- a/src/query/src/qAggMain.c +++ b/src/query/src/qAggMain.c @@ -190,12 +190,12 @@ typedef struct { } SMovingAvgInfo; typedef struct { - int32_t totalPoints; - int32_t numSampled; - int16_t colBytes; - char *values; + int32_t totalPoints; + int32_t numSampled; + uint16_t colBytes; + char *values; int64_t *timeStamps; - char *taglists; + char *taglists; } SSampleFuncInfo; typedef struct SElapsedInfo { @@ -5271,7 +5271,7 @@ static void mavg_function(SQLFunctionCtx *pCtx) { ////////////////////////////////////////////////////////////////////////////////// // Sample function with reservoir sampling algorithm -static void assignResultSample(SQLFunctionCtx *pCtx, SSampleFuncInfo *pInfo, int32_t idx, int64_t ts, void *pData, uint16_t type, int16_t bytes, char *inputTags) { +static void assignResultSample(SQLFunctionCtx *pCtx, SSampleFuncInfo *pInfo, int32_t idx, int64_t ts, void *pData, uint16_t type, uint16_t bytes, char *inputTags) { assignVal(pInfo->values + idx*bytes, pData, bytes, type); *(pInfo->timeStamps + idx) = ts; @@ -5296,7 +5296,7 @@ static void assignResultSample(SQLFunctionCtx *pCtx, SSampleFuncInfo *pInfo, int } } -static void do_reservoir_sample(SQLFunctionCtx *pCtx, SSampleFuncInfo *pInfo, int32_t samplesK, int64_t ts, void *pData, uint16_t type, int16_t bytes) { +static void do_reservoir_sample(SQLFunctionCtx *pCtx, SSampleFuncInfo *pInfo, int32_t samplesK, int64_t ts, void *pData, uint16_t type, uint16_t bytes) { pInfo->totalPoints++; if (pInfo->numSampled < samplesK) { assignResultSample(pCtx, pInfo, pInfo->numSampled, ts, pData, type, bytes, NULL); diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 0065057bc9..3ad7b7e309 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -338,9 +338,9 @@ static void sortGroupResByOrderList(SGroupResInfo* pGroupResInfo, SQueryRuntimeE } // get dataOffset and index on pRuntimeEnv->pQueryAttr->pExpr1 - int16_t dataOffset = 0; - int16_t type = 0; - int32_t bytes = 0; + uint16_t dataOffset = 0; + int16_t type = 0; + int32_t bytes = 0; for (int32_t j = 0; j < pDataBlock->info.numOfCols; ++j) { SColumnInfoData* pColInfoData = (SColumnInfoData*)taosArrayGet(pDataBlock->pDataBlock, j); if (pCtx[j].colId == pFirstGroupCol->colId) { @@ -2074,7 +2074,7 @@ static int32_t setGroupResultOutputBuf(SQueryRuntimeEnv* pRuntimeEnv, SOptrBasic SQLFunctionCtx* pCtx = binfo->pCtx; // not assign result buffer yet, add new result buffer, TODO remove it - char* d = pData; + char* d = pData; uint16_t len = bytes; int64_t tid = 0; @@ -2283,7 +2283,7 @@ static SQLFunctionCtx* createSQLFunctionCtx(SQueryRuntimeEnv* pRuntimeEnv, SExpr pCtx->numOfParams = pSqlExpr->numOfParams; for (int32_t j = 0; j < pCtx->numOfParams; ++j) { int16_t type = pSqlExpr->param[j].nType; - int16_t bytes = pSqlExpr->param[j].nLen; + int32_t bytes = pSqlExpr->param[j].nLen; if (pSqlExpr->functionId == TSDB_FUNC_STDDEV_DST || pSqlExpr->functionId == TSDB_FUNC_TS_COMP) { continue; } @@ -3297,7 +3297,7 @@ void doCompactSDataBlock(SSDataBlock* pBlock, int32_t numOfRows, int8_t* p) { for (int32_t i = 0; i < pBlock->info.numOfCols; ++i) { SColumnInfoData* pColumnInfoData = taosArrayGet(pBlock->pDataBlock, i); - int16_t bytes = pColumnInfoData->info.bytes; + int32_t bytes = pColumnInfoData->info.bytes; memmove(((char*)pColumnInfoData->pData) + start * bytes, pColumnInfoData->pData + cstart * bytes, len * bytes); } @@ -3313,7 +3313,7 @@ void doCompactSDataBlock(SSDataBlock* pBlock, int32_t numOfRows, int8_t* p) { for (int32_t i = 0; i < pBlock->info.numOfCols; ++i) { SColumnInfoData* pColumnInfoData = taosArrayGet(pBlock->pDataBlock, i); - int16_t bytes = pColumnInfoData->info.bytes; + int32_t bytes = pColumnInfoData->info.bytes; memmove(pColumnInfoData->pData + start * bytes, pColumnInfoData->pData + cstart * bytes, len * bytes); } @@ -6681,7 +6681,7 @@ static SSDataBlock* doLimit(void* param, bool* newgroup) { for (int32_t i = 0; i < pBlock->info.numOfCols; ++i) { SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i); - int16_t bytes = pColInfoData->info.bytes; + int32_t bytes = pColInfoData->info.bytes; memmove(pColInfoData->pData, pColInfoData->pData + skip * bytes, remain * bytes); } @@ -7384,7 +7384,7 @@ static void doStateWindowAggImpl(SOperatorInfo* pOperator, SStateWindowOperatorI SOptrBasicInfo* pBInfo = &pInfo->binfo; bool masterScan = IS_MASTER_SCAN(pRuntimeEnv); - int16_t bytes = pColInfoData->info.bytes; + int32_t bytes = pColInfoData->info.bytes; // int16_t type = pColInfoData->info.type; SColumnInfoData* pTsColInfoData = taosArrayGet(pSDataBlock->pDataBlock, 0); @@ -8584,7 +8584,7 @@ static SSDataBlock* doTagScan(void* param, bool* newgroup) { count = 0; - uint16_t bytes = pExprInfo->base.resBytes; + int32_t bytes = pExprInfo->base.resBytes; int16_t type = pExprInfo->base.resType; for (int32_t i = 0; i < pQueryAttr->numOfTags; ++i) { @@ -8659,7 +8659,7 @@ static SSDataBlock* doTagScan(void* param, bool* newgroup) { char * data = NULL, *dst = NULL; int16_t type = 0; - uint16_t bytes = 0; + int32_t bytes = 0; for (int32_t j = 0; j < pOperator->numOfOutput; ++j) { // not assign value in case of user defined constant output column if (TSDB_COL_IS_UD_COL(pExprInfo[j].base.colInfo.flag)) { @@ -9690,8 +9690,8 @@ int32_t createQueryFunc(SQueriedTableInfo* pTableInfo, int32_t numOfOutput, SExp tVariantAssign(&pExprs[i].base.param[j], &pExprMsg[i]->param[j]); } - int16_t type = 0; - int16_t bytes = 0; + int16_t type = 0; + uint16_t bytes = 0; // parse the arithmetic expression if (pExprs[i].base.functionId == TSDB_FUNC_SCALAR_EXPR) { @@ -9834,7 +9834,7 @@ int32_t createIndirectQueryFuncExprFromMsg(SQueryTableMsg* pQueryMsg, int32_t nu pExprs[i].base.resType = 0; int16_t type = 0; - int16_t bytes = 0; + int32_t bytes = 0; // parse the arithmetic expression if (pExprs[i].base.functionId == TSDB_FUNC_SCALAR_EXPR) { diff --git a/src/query/src/qPercentile.c b/src/query/src/qPercentile.c index 2ee3536ebb..78680cd81e 100644 --- a/src/query/src/qPercentile.c +++ b/src/query/src/qPercentile.c @@ -267,8 +267,8 @@ tMemBucket *tMemBucketCreate(uint16_t nElemSize, int16_t dataType, double minval tMemBucketDestroy(pBucket); return NULL; } - - qDebug("MemBucket:%p, elem size:%d", pBucket, pBucket->bytes); + + qDebug("MemBucket:%p, elem size:%" PRIu16, pBucket, pBucket->bytes); return pBucket; } -- GitLab