enh(query): improve the perf.

This commit is contained in:
Haojun Liao 2022-11-08 17:38:09 +08:00
parent f85d66f5ee
commit 6e1a2b1e54
2 changed files with 11 additions and 6 deletions

View File

@ -957,11 +957,15 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
int32_t i = 0;
SColumnInfoData* pColData = taosArrayGet(pResBlock->pDataBlock, i);
if (pColData->info.colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
if (asc) {
memcpy(pColData->pData, &pBlockData->aTSKEY[pDumpInfo->rowIndex], remain * sizeof(int64_t));
} else {
for (int32_t j = pDumpInfo->rowIndex; rowIndex < remain; j += step) {
colDataAppendInt64(pColData, rowIndex++, &pBlockData->aTSKEY[j]);
if (!asc) { // reverse the array list
int32_t mid = remain / 2;
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;
}
}

View File

@ -3103,8 +3103,9 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) {
}
}
#endif
if (numOfElems == 0) {
// save selectivity value for column consisted of all null values
if (numOfElems == 0) {
firstlastSaveTupleData(pCtx->pSrcBlock, pInput->startRowIndex, pCtx, pInfo);
}
SET_VAL(pResInfo, numOfElems, 1);