Merge branch 'feature/qrefactor' of https://github.com/taosdata/TDengine into feature/qrefactor
This commit is contained in:
commit
e1dc3078cf
|
@ -362,7 +362,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
|
||||||
// TODO use hash table
|
// TODO use hash table
|
||||||
int32_t isValidFunction(const char* name, int32_t len) {
|
int32_t isValidFunction(const char* name, int32_t len) {
|
||||||
for(int32_t i = 0; i <= TSDB_FUNC_BLKINFO; ++i) {
|
for(int32_t i = 0; i <= TSDB_FUNC_BLKINFO; ++i) {
|
||||||
int32_t nameLen = strlen(aAggs[i].name);
|
int32_t nameLen = (int32_t) strlen(aAggs[i].name);
|
||||||
if (len != nameLen) {
|
if (len != nameLen) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -4282,7 +4282,7 @@ static void interp_function_impl(SQLFunctionCtx *pCtx) {
|
||||||
if (type == TSDB_FILL_PREV) {
|
if (type == TSDB_FILL_PREV) {
|
||||||
assignVal(pCtx->pOutput, pCtx->pInput, pCtx->outputBytes, pCtx->inputType);
|
assignVal(pCtx->pOutput, pCtx->pInput, pCtx->outputBytes, pCtx->inputType);
|
||||||
} else if (type == TSDB_FILL_NEXT) {
|
} else if (type == TSDB_FILL_NEXT) {
|
||||||
char* val = pCtx->pInput + pCtx->inputBytes;
|
char* val = ((char*)pCtx->pInput) + pCtx->inputBytes;
|
||||||
assignVal(pCtx->pOutput, val, pCtx->outputBytes, pCtx->inputType);
|
assignVal(pCtx->pOutput, val, pCtx->outputBytes, pCtx->inputType);
|
||||||
} else if (type == TSDB_FILL_LINEAR) {
|
} else if (type == TSDB_FILL_LINEAR) {
|
||||||
char *start = GET_INPUT_DATA(pCtx, 0);
|
char *start = GET_INPUT_DATA(pCtx, 0);
|
||||||
|
@ -4747,8 +4747,8 @@ void blockInfo_func(SQLFunctionCtx* pCtx) {
|
||||||
STableBlockDist* pDist = (STableBlockDist*) GET_ROWCELL_INTERBUF(pResInfo);
|
STableBlockDist* pDist = (STableBlockDist*) GET_ROWCELL_INTERBUF(pResInfo);
|
||||||
|
|
||||||
int32_t len = *(int32_t*) pCtx->pInput;
|
int32_t len = *(int32_t*) pCtx->pInput;
|
||||||
blockDistInfoFromBinary(pCtx->pInput + sizeof(int32_t), len, pDist);
|
blockDistInfoFromBinary((char*)pCtx->pInput + sizeof(int32_t), len, pDist);
|
||||||
pDist->rowSize = pCtx->param[0].i64;
|
pDist->rowSize = (int16_t) pCtx->param[0].i64;
|
||||||
|
|
||||||
memcpy(pCtx->pOutput, pCtx->pInput, sizeof(int32_t) + len);
|
memcpy(pCtx->pOutput, pCtx->pInput, sizeof(int32_t) + len);
|
||||||
|
|
||||||
|
@ -4767,7 +4767,7 @@ static void mergeTableBlockDist(STableBlockDist* pDist, const STableBlockDist* p
|
||||||
pDist->dataBlockInfos = taosArrayInit(4, sizeof(SFileBlockInfo));
|
pDist->dataBlockInfos = taosArrayInit(4, sizeof(SFileBlockInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
taosArrayPushBatch(pDist->dataBlockInfos, pSrc->dataBlockInfos->pData, taosArrayGetSize(pSrc->dataBlockInfos));
|
taosArrayPushBatch(pDist->dataBlockInfos, pSrc->dataBlockInfos->pData, (int32_t) taosArrayGetSize(pSrc->dataBlockInfos));
|
||||||
}
|
}
|
||||||
|
|
||||||
void block_func_merge(SQLFunctionCtx* pCtx) {
|
void block_func_merge(SQLFunctionCtx* pCtx) {
|
||||||
|
@ -4777,7 +4777,7 @@ void block_func_merge(SQLFunctionCtx* pCtx) {
|
||||||
STableBlockDist info = {0};
|
STableBlockDist info = {0};
|
||||||
|
|
||||||
int32_t len = *(int32_t*) pCtx->pInput;
|
int32_t len = *(int32_t*) pCtx->pInput;
|
||||||
blockDistInfoFromBinary(pCtx->pInput + sizeof(int32_t), len, &info);
|
blockDistInfoFromBinary(((char*)pCtx->pInput) + sizeof(int32_t), len, &info);
|
||||||
|
|
||||||
mergeTableBlockDist(pDist, &info);
|
mergeTableBlockDist(pDist, &info);
|
||||||
}
|
}
|
||||||
|
@ -4851,7 +4851,7 @@ void blockinfo_func_finalizer(SQLFunctionCtx* pCtx) {
|
||||||
SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx);
|
SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx);
|
||||||
STableBlockDist* pDist = (STableBlockDist*) GET_ROWCELL_INTERBUF(pResInfo);
|
STableBlockDist* pDist = (STableBlockDist*) GET_ROWCELL_INTERBUF(pResInfo);
|
||||||
|
|
||||||
pDist->rowSize = pCtx->param[0].i64;
|
pDist->rowSize = (int16_t)pCtx->param[0].i64;
|
||||||
generateBlockDistResult(pDist, pCtx->pOutput);
|
generateBlockDistResult(pDist, pCtx->pOutput);
|
||||||
|
|
||||||
// cannot set the numOfIteratedElems again since it is set during previous iteration
|
// cannot set the numOfIteratedElems again since it is set during previous iteration
|
||||||
|
|
|
@ -560,7 +560,7 @@ static int32_t addNewWindowResultBuf(SResultRow *pWindowRes, SDiskbasedResultBuf
|
||||||
// set the number of rows in current disk page
|
// set the number of rows in current disk page
|
||||||
if (pWindowRes->pageId == -1) { // not allocated yet, allocate new buffer
|
if (pWindowRes->pageId == -1) { // not allocated yet, allocate new buffer
|
||||||
pWindowRes->pageId = pageId;
|
pWindowRes->pageId = pageId;
|
||||||
pWindowRes->offset = pData->num;
|
pWindowRes->offset = (int32_t)pData->num;
|
||||||
|
|
||||||
pData->num += size;
|
pData->num += size;
|
||||||
assert(pWindowRes->pageId >= 0);
|
assert(pWindowRes->pageId >= 0);
|
||||||
|
@ -941,7 +941,7 @@ static void doSetInputDataBlockInfo(SOperatorInfo* pOperator, SQLFunctionCtx* pC
|
||||||
for (int32_t i = 0; i < pOperator->numOfOutput; ++i) {
|
for (int32_t i = 0; i < pOperator->numOfOutput; ++i) {
|
||||||
pCtx[i].order = order;
|
pCtx[i].order = order;
|
||||||
pCtx[i].size = pBlock->info.rows;
|
pCtx[i].size = pBlock->info.rows;
|
||||||
pCtx[i].currentStage = pOperator->pRuntimeEnv->scanFlag;
|
pCtx[i].currentStage = (uint8_t)pOperator->pRuntimeEnv->scanFlag;
|
||||||
|
|
||||||
setBlockStatisInfo(&pCtx[i], pBlock, &pOperator->pExpr[i].base.colInfo);
|
setBlockStatisInfo(&pCtx[i], pBlock, &pOperator->pExpr[i].base.colInfo);
|
||||||
}
|
}
|
||||||
|
@ -968,7 +968,7 @@ static void doSetInputDataBlock(SOperatorInfo* pOperator, SQLFunctionCtx* pCtx,
|
||||||
for (int32_t i = 0; i < pOperator->numOfOutput; ++i) {
|
for (int32_t i = 0; i < pOperator->numOfOutput; ++i) {
|
||||||
pCtx[i].order = order;
|
pCtx[i].order = order;
|
||||||
pCtx[i].size = pBlock->info.rows;
|
pCtx[i].size = pBlock->info.rows;
|
||||||
pCtx[i].currentStage = pOperator->pRuntimeEnv->scanFlag;
|
pCtx[i].currentStage = (uint8_t)pOperator->pRuntimeEnv->scanFlag;
|
||||||
|
|
||||||
setBlockStatisInfo(&pCtx[i], pBlock, &pOperator->pExpr[i].base.colInfo);
|
setBlockStatisInfo(&pCtx[i], pBlock, &pOperator->pExpr[i].base.colInfo);
|
||||||
|
|
||||||
|
@ -1296,7 +1296,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t j = 0; j < pSDataBlock->info.rows; ++j) {
|
for (int32_t j = 0; j < pSDataBlock->info.rows; ++j) {
|
||||||
char* val = pColInfoData->pData + bytes * j;
|
char* val = ((char*)pColInfoData->pData) + bytes * j;
|
||||||
if (isNull(val, type)) {
|
if (isNull(val, type)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2351,7 +2351,7 @@ void filterRowsInDataBlock(SQueryRuntimeEnv* pRuntimeEnv, SSingleColumnFilterInf
|
||||||
SColumnInfoData *pColumnInfoData = taosArrayGet(pBlock->pDataBlock, i);
|
SColumnInfoData *pColumnInfoData = taosArrayGet(pBlock->pDataBlock, i);
|
||||||
|
|
||||||
int16_t bytes = pColumnInfoData->info.bytes;
|
int16_t bytes = pColumnInfoData->info.bytes;
|
||||||
memmove(pColumnInfoData->pData + start * bytes, pColumnInfoData->pData + cstart * bytes, len * bytes);
|
memmove(((char*)pColumnInfoData->pData) + start * bytes, pColumnInfoData->pData + cstart * bytes, len * bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
start += len;
|
start += len;
|
||||||
|
@ -3446,7 +3446,7 @@ static void toSSDataBlock(SGroupResInfo *pGroupResInfo, SQueryRuntimeEnv* pRunti
|
||||||
if (pInfoData->info.type == TSDB_DATA_TYPE_TIMESTAMP) {
|
if (pInfoData->info.type == TSDB_DATA_TYPE_TIMESTAMP) {
|
||||||
STimeWindow* w = &pBlock->info.window;
|
STimeWindow* w = &pBlock->info.window;
|
||||||
w->skey = *(int64_t*)pInfoData->pData;
|
w->skey = *(int64_t*)pInfoData->pData;
|
||||||
w->ekey = *(int64_t*)(pInfoData->pData + TSDB_KEYSIZE * (pBlock->info.rows - 1));
|
w->ekey = *(int64_t*)(((char*)pInfoData->pData) + TSDB_KEYSIZE * (pBlock->info.rows - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2644,7 +2644,7 @@ bool tsdbGetExternalRow(TsdbQueryHandleT pHandle) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t numOfCols = QH_GET_NUM_OF_COLS(pQueryHandle);
|
int32_t numOfCols = (int32_t) QH_GET_NUM_OF_COLS(pQueryHandle);
|
||||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||||
SColumnInfoData* pColInfoData = taosArrayGet(pQueryHandle->pColumns, i);
|
SColumnInfoData* pColInfoData = taosArrayGet(pQueryHandle->pColumns, i);
|
||||||
SColumnInfoData* first = taosArrayGet(pQueryHandle->prev, i);
|
SColumnInfoData* first = taosArrayGet(pQueryHandle->prev, i);
|
||||||
|
@ -2652,11 +2652,11 @@ bool tsdbGetExternalRow(TsdbQueryHandleT pHandle) {
|
||||||
memcpy(pColInfoData->pData, first->pData, pColInfoData->info.bytes);
|
memcpy(pColInfoData->pData, first->pData, pColInfoData->info.bytes);
|
||||||
|
|
||||||
SColumnInfoData* sec = taosArrayGet(pQueryHandle->next, i);
|
SColumnInfoData* sec = taosArrayGet(pQueryHandle->next, i);
|
||||||
memcpy(pColInfoData->pData + pColInfoData->info.bytes, sec->pData, pColInfoData->info.bytes);
|
memcpy(((char*)pColInfoData->pData) + pColInfoData->info.bytes, sec->pData, pColInfoData->info.bytes);
|
||||||
|
|
||||||
if (i == 0 && pColInfoData->info.type == TSDB_DATA_TYPE_TIMESTAMP) {
|
if (i == 0 && pColInfoData->info.type == TSDB_DATA_TYPE_TIMESTAMP) {
|
||||||
cur->win.skey = *(TSKEY*)pColInfoData->pData;
|
cur->win.skey = *(TSKEY*)pColInfoData->pData;
|
||||||
cur->win.ekey = *(TSKEY*)(pColInfoData->pData + TSDB_KEYSIZE);
|
cur->win.ekey = *(TSKEY*)(((char*)pColInfoData->pData) + TSDB_KEYSIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue