fix(query):fix the invalid returned code in the compare function
This commit is contained in:
parent
cc4332d5ac
commit
fc5544d42a
|
@ -440,19 +440,19 @@ static void doHashPartition(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
|
||||||
recordNewGroupKeys(pInfo->pGroupCols, pInfo->pGroupColVals, pBlock, j);
|
recordNewGroupKeys(pInfo->pGroupCols, pInfo->pGroupColVals, pBlock, j);
|
||||||
int32_t len = buildGroupKeys(pInfo->keyBuf, pInfo->pGroupColVals);
|
int32_t len = buildGroupKeys(pInfo->keyBuf, pInfo->pGroupColVals);
|
||||||
|
|
||||||
SDataGroupInfo* pGInfo = NULL;
|
SDataGroupInfo* pGroupInfo = NULL;
|
||||||
void *pPage = getCurrentDataGroupInfo(pInfo, &pGInfo, len);
|
void *pPage = getCurrentDataGroupInfo(pInfo, &pGroupInfo, len);
|
||||||
|
|
||||||
pGInfo->numOfRows += 1;
|
pGroupInfo->numOfRows += 1;
|
||||||
if (pGInfo->groupId == 0) {
|
|
||||||
pGInfo->groupId = calcGroupId(pInfo->keyBuf, len);
|
// group id
|
||||||
|
if (pGroupInfo->groupId == 0) {
|
||||||
|
pGroupInfo->groupId = calcGroupId(pInfo->keyBuf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
// number of rows
|
// number of rows
|
||||||
int32_t* rows = (int32_t*) pPage;
|
int32_t* rows = (int32_t*) pPage;
|
||||||
|
|
||||||
// group id
|
|
||||||
|
|
||||||
size_t numOfCols = pOperator->exprSupp.numOfExprs;
|
size_t numOfCols = pOperator->exprSupp.numOfExprs;
|
||||||
for(int32_t i = 0; i < numOfCols; ++i) {
|
for(int32_t i = 0; i < numOfCols; ++i) {
|
||||||
SExprInfo* pExpr = &pOperator->exprSupp.pExprInfo[i];
|
SExprInfo* pExpr = &pOperator->exprSupp.pExprInfo[i];
|
||||||
|
@ -603,7 +603,13 @@ static void clearPartitionOperator(SPartitionOperatorInfo* pInfo) {
|
||||||
static int compareDataGroupInfo(const void* group1, const void* group2) {
|
static int compareDataGroupInfo(const void* group1, const void* group2) {
|
||||||
const SDataGroupInfo* pGroupInfo1 = group1;
|
const SDataGroupInfo* pGroupInfo1 = group1;
|
||||||
const SDataGroupInfo* pGroupInfo2 = group2;
|
const SDataGroupInfo* pGroupInfo2 = group2;
|
||||||
return pGroupInfo1->groupId - pGroupInfo2->groupId;
|
|
||||||
|
if (pGroupInfo1->groupId == pGroupInfo2->groupId) {
|
||||||
|
ASSERT(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (pGroupInfo1->groupId < pGroupInfo2->groupId)? -1:1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSDataBlock* buildPartitionResult(SOperatorInfo* pOperator) {
|
static SSDataBlock* buildPartitionResult(SOperatorInfo* pOperator) {
|
||||||
|
|
|
@ -91,7 +91,7 @@ SSortHandle* tsortCreateSortHandle(SArray* pSortInfo, int32_t type, int32_t page
|
||||||
tsortSetComparFp(pSortHandle, msortComparFn);
|
tsortSetComparFp(pSortHandle, msortComparFn);
|
||||||
|
|
||||||
if (idstr != NULL) {
|
if (idstr != NULL) {
|
||||||
pSortHandle->idStr = strdup(idstr);
|
pSortHandle->idStr = strdup(idstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pSortHandle;
|
return pSortHandle;
|
||||||
|
|
Loading…
Reference in New Issue