提交 f72c9837 编写于 作者: wmmhello's avatar wmmhello

modify test case

上级 865a13c1
......@@ -409,7 +409,7 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd
}
}
if (size > pageSize) {
if (size > pageSize) { // pageSize must be able to hold one row
*stopIndex = j - 1;
ASSERT(*stopIndex >= startIndex);
......
......@@ -6155,7 +6155,7 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSDataBlock* pR
return NULL;
}
pInfo->bufPageSize = rowSize < 1024 ? 1024 : rowSize*2;
pInfo->bufPageSize = rowSize < 1024 ? 1024*2 : rowSize*2; // there are headers, so pageSize = rowSize + header
pInfo->sortBufSize = pInfo->bufPageSize * 16; // TODO dynamic set the available sort buffer
pInfo->numOfRowsInRes = 1024;
......
......@@ -287,7 +287,13 @@ TEST(testCase, external_mem_sort_Test) {
for (int i = 0; i < 8; i++){
SBlockOrderInfo oi = {0};
oi.order = TSDB_ORDER_ASC;
if(pInfo[i].type == TSDB_DATA_TYPE_NCHAR){
oi.order = TSDB_ORDER_DESC;
}else{
oi.order = TSDB_ORDER_ASC;
}
oi.slotId = 0;
SArray* orderInfo = taosArrayInit(1, sizeof(SBlockOrderInfo));
taosArrayPush(orderInfo, &oi);
......@@ -363,15 +369,16 @@ TEST(testCase, ordered_merge_sort_Test) {
tsortSetFetchRawDataFp(phandle, getSingleColDummyBlock);
tsortSetComparFp(phandle, docomp);
SGenericSource* p = static_cast<SGenericSource*>(taosMemoryCalloc(10, sizeof(SGenericSource)));
_info* c = static_cast<_info*>(taosMemoryCalloc(10, sizeof(_info)));
for(int32_t i = 0; i < 10; ++i) {
SGenericSource* p = static_cast<SGenericSource*>(taosMemoryCalloc(1, sizeof(SGenericSource)));
_info* c = static_cast<_info*>(taosMemoryCalloc(1, sizeof(_info)));
c->count = 1;
c->pageRows = 1000;
c->startVal = i*1000;
p->param = c;
tsortAddSource(phandle, p);
c[i].count = 1;
c[i].pageRows = 1000;
c[i].startVal = i*1000;
c[i].type = TSDB_DATA_TYPE_INT;
p[i].param = c;
tsortAddSource(phandle, &p[i]);
}
int32_t code = tsortOpen(phandle);
......@@ -388,8 +395,10 @@ TEST(testCase, ordered_merge_sort_Test) {
ASSERT_EQ(row++, *(int32_t*) v);
}
taosMemoryFree(p);
taosMemoryFree(c);
tsortDestroySortHandle(phandle);
taosMemoryFree(pBlock);
blockDataDestroy(pBlock);
}
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册