提交 3d156255 编写于 作者: H Haojun Liao

[td-11818] opt performance

上级 51797a8b
......@@ -538,18 +538,18 @@ int32_t dataBlockCompar(const void* p1, const void* p2, const void* param) {
SSDataBlock* pDataBlock = pHelper->pDataBlock;
int32_t* left = (int32_t*) p1;
int32_t* right = (int32_t*) p2;
int32_t left = *(int32_t*) p1;
int32_t right = *(int32_t*) p2;
SArray* pInfo = pHelper->orderInfo;
for(int32_t i = 0; i < pInfo->size; ++i) {
SBlockOrderInfo* pOrder = taosArrayGet(pInfo, i);
SBlockOrderInfo* pOrder = TARRAY_GET_ELEM(pInfo, i);
SColumnInfoData* pColInfoData = TARRAY_GET_ELEM(pDataBlock->pDataBlock, pOrder->colIndex);
if (pColInfoData->hasNull) {
bool leftNull = colDataIsNull(pColInfoData, pDataBlock->info.rows, *left, pDataBlock->pBlockAgg);
bool rightNull = colDataIsNull(pColInfoData, pDataBlock->info.rows, *right, pDataBlock->pBlockAgg);
bool leftNull = colDataIsNull(pColInfoData, pDataBlock->info.rows, left, pDataBlock->pBlockAgg);
bool rightNull = colDataIsNull(pColInfoData, pDataBlock->info.rows, right, pDataBlock->pBlockAgg);
if (leftNull && rightNull) {
continue; // continue to next slot
}
......@@ -563,8 +563,8 @@ int32_t dataBlockCompar(const void* p1, const void* p2, const void* param) {
}
}
void* left1 = colDataGet(pColInfoData, *left);
void* right1 = colDataGet(pColInfoData, *right);
void* left1 = colDataGet(pColInfoData, left);
void* right1 = colDataGet(pColInfoData, right);
switch(pColInfoData->info.type) {
case TSDB_DATA_TYPE_INT: {
......@@ -575,9 +575,9 @@ int32_t dataBlockCompar(const void* p1, const void* p2, const void* param) {
break;
} else {
if (pOrder->order == TSDB_ORDER_ASC) {
return (leftx <= rightx)? -1:1;
return (leftx < rightx)? -1:1;
} else {
return (leftx <= rightx)? 1:-1;
return (leftx < rightx)? 1:-1;
}
}
}
......
......@@ -78,7 +78,7 @@ SSDataBlock* getDummyBlock(void* param, bool* newgroup) {
char buf[128] = {0};
char b1[128] = {0};
for(int32_t i = 0; i < numOfRows; ++i) {
SColumnInfoData* pColInfo = static_cast<SColumnInfoData*>(taosArrayGet(pBlock->pDataBlock, 0));
SColumnInfoData* pColInfo = static_cast<SColumnInfoData*>(TARRAY_GET_ELEM(pBlock->pDataBlock, 0));
int32_t v = (--pInfo->startVal);
colDataAppend(pColInfo, i, reinterpret_cast<const char*>(&v), false);
......@@ -86,7 +86,7 @@ SSDataBlock* getDummyBlock(void* param, bool* newgroup) {
sprintf(buf, "this is %d row", i);
STR_TO_VARSTR(b1, buf);
SColumnInfoData* pColInfo2 = static_cast<SColumnInfoData*>(taosArrayGet(pBlock->pDataBlock, 1));
SColumnInfoData* pColInfo2 = static_cast<SColumnInfoData*>(TARRAY_GET_ELEM(pBlock->pDataBlock, 1));
colDataAppend(pColInfo2, i, b1, false);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册