提交 6e1a2b1e 编写于 作者: H Haojun Liao

enh(query): improve the perf.

上级 f85d66f5
...@@ -957,11 +957,15 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn ...@@ -957,11 +957,15 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
int32_t i = 0; int32_t i = 0;
SColumnInfoData* pColData = taosArrayGet(pResBlock->pDataBlock, i); SColumnInfoData* pColData = taosArrayGet(pResBlock->pDataBlock, i);
if (pColData->info.colId == PRIMARYKEY_TIMESTAMP_COL_ID) { if (pColData->info.colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
if (asc) { memcpy(pColData->pData, &pBlockData->aTSKEY[pDumpInfo->rowIndex], remain * sizeof(int64_t));
memcpy(pColData->pData, &pBlockData->aTSKEY[pDumpInfo->rowIndex], remain * sizeof(int64_t));
} else { if (!asc) { // reverse the array list
for (int32_t j = pDumpInfo->rowIndex; rowIndex < remain; j += step) { int32_t mid = remain / 2;
colDataAppendInt64(pColData, rowIndex++, &pBlockData->aTSKEY[j]); TSKEY* pts = (int64_t*)pColData->pData;
for (int32_t j = 0; j < mid; ++j) {
int64_t t = pts[i];
pts[j] = pts[remain - j - 1];
pts[remain - j - 1] = t;
} }
} }
......
...@@ -3103,8 +3103,9 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) { ...@@ -3103,8 +3103,9 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) {
} }
} }
#endif #endif
// save selectivity value for column consisted of all null values
if (numOfElems == 0) { if (numOfElems == 0) {
// save selectivity value for column consisted of all null values
firstlastSaveTupleData(pCtx->pSrcBlock, pInput->startRowIndex, pCtx, pInfo); firstlastSaveTupleData(pCtx->pSrcBlock, pInput->startRowIndex, pCtx, pInfo);
} }
SET_VAL(pResInfo, numOfElems, 1); SET_VAL(pResInfo, numOfElems, 1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册