提交 bc8ac5f0 编写于 作者: 5 54liuyao

fix(executor): last function optimize error

上级 c1c07861
......@@ -318,10 +318,10 @@ static int32_t getColDataFromGroupRes(SGroupResInfo* pGroupResInfo, SQueryRuntim
for (int32_t i = 0; i < numRows; ++i) {
SResultRow* row = taosArrayGetP(pGroupResInfo->pRows, i);
row->groupIndex = i;
tFilePage* page = getResBufPage(pRuntimeEnv->pResultBuf, row->pageId);
int32_t rowsToCopy = 1;
char* out = colData + numOfResult * colBytes;
char* in = getPosInResultPage(pRuntimeEnv->pQueryAttr, page, row->offset, colDataOffset);
tFilePage* page = getResBufPage(pRuntimeEnv->pResultBuf, row->pageId);
int32_t rowsToCopy = 1;
char* out = colData + numOfResult * colBytes;
char* in = getPosInResultPage(pRuntimeEnv->pQueryAttr, page, row->offset, colDataOffset);
memcpy(out, in, colBytes * rowsToCopy);
numOfResult += rowsToCopy;
}
......@@ -2837,6 +2837,10 @@ static bool isCachedLastQuery(SQueryAttr* pQueryAttr) {
return false;
}
if (pQueryAttr->pFilters != NULL || pQueryAttr->pFilterInfo != NULL) {
return false;
}
return true;
}
......@@ -3165,7 +3169,7 @@ static bool overlapWithTimeWindow(SQueryAttr* pQueryAttr, SDataBlockInfo* pBlock
return true;
}
while(w.skey < pBlockInfo->window.ekey) {
while (w.skey < pBlockInfo->window.ekey) {
// add one slding
if (pQueryAttr->interval.slidingUnit == 'n' || pQueryAttr->interval.slidingUnit == 'y')
ekey = taosTimeAdd(ekey, pQueryAttr->interval.sliding, pQueryAttr->interval.slidingUnit, pQueryAttr->precision);
......@@ -3180,7 +3184,7 @@ static bool overlapWithTimeWindow(SQueryAttr* pQueryAttr, SDataBlockInfo* pBlock
getAlignQueryTimeWindow(pQueryAttr, ekey, sk, ek, &w);
}
while(1) {
while (1) {
if (w.ekey < pBlockInfo->window.skey) {
break;
}
......@@ -6339,7 +6343,7 @@ SOperatorInfo* createOrderOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorI
SColumnInfoData col = {{0}};
col.info.colId = pExpr[i].base.colInfo.colId;
col.info.bytes = pExpr[i].base.resBytes;
col.info.type = pExpr[i].base.resType;
col.info.type = pExpr[i].base.resType;
taosArrayPush(pDataBlock->pDataBlock, &col);
if (!found && col.info.colId == pOrderVal->orderColId) {
......@@ -6874,18 +6878,18 @@ static bool doEveryInterpolation(SOperatorInfo* pOperatorInfo, SSDataBlock* pBlo
break;
}
}
if (pCtx == NULL) {
goto group_finished_exit;
}
TSKEY* tsCols = NULL;
if (pBlock && pBlock->pDataBlock != NULL) {
SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, 0);
tsCols = (int64_t*)pColDataInfo->pData;
assert(tsCols[0] == pBlock->info.window.skey && tsCols[pBlock->info.rows - 1] == pBlock->info.window.ekey);
}
if (pCtx->startTs == INT64_MIN) {
if (pQueryAttr->range.skey == INT64_MIN) {
if (NULL == tsCols) {
......@@ -6984,7 +6988,7 @@ static bool doEveryInterpolation(SOperatorInfo* pOperatorInfo, SSDataBlock* pBlo
return false;
}
int32_t nRows = pBlock ? pBlock->info.rows : 0;
int32_t startPos = binarySearchForKey((char*) tsCols, nRows, pCtx->startTs, pQueryAttr->order.order);
int32_t startPos = binarySearchForKey((char*)tsCols, nRows, pCtx->startTs, pQueryAttr->order.order);
if (ascQuery && pQueryAttr->fillType != TSDB_FILL_NEXT && pCtx->start.key == INT64_MIN) {
if (startPos < 0) {
......@@ -8522,18 +8526,18 @@ SOperatorInfo* createSLimitOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperator
SColIndex* idx = taosArrayGet(pInfo->orderColumnList, i);
offset += pExpr[idx->colIndex].base.resBytes;
}
SOperatorInfo* pOperator = calloc(1, sizeof(SOperatorInfo));
if (pOperator == NULL) {
goto _clean;
}
pInfo->pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity);
if (pInfo->pRes == NULL) {
tfree(pOperator);
goto _clean;
}
pOperator->name = "SLimitOperator";
pOperator->operatorType = OP_SLimit;
pOperator->blockingOptr = false;
......@@ -10171,7 +10175,8 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SGroupbyExpr* pGroupbyExpr, S
pTableqinfo->pGroupList = taosArrayInit(numOfGroups, POINTER_BYTES);
pTableqinfo->numOfTables = pTableGroupInfo->numOfTables;
pTableqinfo->map = taosHashInit(pTableGroupInfo->numOfTables, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK);
pTableqinfo->map = taosHashInit(pTableGroupInfo->numOfTables, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true,
HASH_ENTRY_LOCK);
}
pQInfo->pBuf = calloc(pTableGroupInfo->numOfTables, sizeof(STableQueryInfo));
......@@ -10373,7 +10378,7 @@ static void doDestroyTableQueryInfo(STableGroupInfo* pTableqinfoGroupInfo) {
taosArrayDestroy(&pTableqinfoGroupInfo->pGroupList);
SHashObj *pmap = pTableqinfoGroupInfo->map;
SHashObj* pmap = pTableqinfoGroupInfo->map;
if (pmap == atomic_val_compare_exchange_ptr(&pTableqinfoGroupInfo->map, pmap, NULL)) {
taosHashCleanup(pmap);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册