提交 d69b1d1b 编写于 作者: H hjxilinx

Fix bugs in issue #988. Fix corresponding invalid and memory leak problems. [tbase-1382].

上级 27f5a5ce
......@@ -2240,6 +2240,7 @@ static void teardownQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv) {
}
tVariantDestroy(&pCtx->tag);
tfree(pCtx->tagInfo.pTagCtxList);
tfree(pRuntimeEnv->resultInfo[i].interResultBuf);
}
......@@ -3687,20 +3688,19 @@ static int32_t allocateOutputBufForGroup(SMeterQuerySupportObj *pSupporter, SQue
return TSDB_CODE_SERV_OUT_OF_MEMORY;
}
// create group result buffer
for (int32_t k = 0; k < slot; ++k) {
SOutputRes *pOneRes = &pSupporter->pResult[k];
pOneRes->nAlloc = 1;
/*
* for top/bottom query, the output for group by normal column, the output rows is equals to the
* maximum rows, instead of 1.
* for single table top/bottom query, the output for group by normal column, the output rows is
* equals to the maximum rows, instead of 1.
*/
if (!isMetricQuery && isTopBottomQuery(pQuery)) {
assert(pQuery->numOfOutputCols > 1);
SSqlFunctionExpr *pExpr = &pQuery->pSelectExpr[1];
if ((pExpr->pBase.functionId == TSDB_FUNC_TOP || pExpr->pBase.functionId == TSDB_FUNC_BOTTOM) &&
pExpr->resType != TSDB_DATA_TYPE_BINARY) {
pOneRes->nAlloc = pExpr->pBase.arg[0].argValue.i64;
} else {
pOneRes->nAlloc = 1;
}
createGroupResultBuf(pQuery, pOneRes, isMetricQuery);
......@@ -6011,14 +6011,14 @@ int32_t getDataBlocksForMeters(SMeterQuerySupportObj *pSupporter, SQuery *pQuery
pSummary->loadCompInfoUs += (et - st);
if (!setCurrentQueryRange(pMeterDataInfo[j], pQuery, pSupporter->rawEKey, &minval, &maxval)) {
clearAllMeterDataBlockInfo(pMeterDataInfo, 0, j);
clearAllMeterDataBlockInfo(pMeterDataInfo, j, j);
continue;
}
int32_t end = 0;
if (!getValidDataBlocksRangeIndex(pMeterDataInfo[j], pQuery, pMeterDataInfo[j]->pBlock, compInfo.numOfBlocks,
minval, maxval, &end)) {
clearAllMeterDataBlockInfo(pMeterDataInfo, 0, j);
clearAllMeterDataBlockInfo(pMeterDataInfo, j, j);
continue;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册