1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

The implementation of the template bubble_sort assumed

that the call-back comparison function returns a positive
number when arg1 < arg2, and a negative number when arg1 > arg2.
This is not in line with other implementation of sorting
algorithm.
Changed bubble_sort: now a negative result from the comparison
function means that arg1 < arg2, and positive result means
that arg1 > arg2.
Changed accordingly all call-back functions that are used as
parameters in the call of bubble_sort.

Added a test case to check the proper sorting of window functions.
This commit is contained in:
Igor Babaev
2016-04-01 12:00:54 -07:00
parent c9ff5cfbfd
commit 2e4bd4407e
7 changed files with 204 additions and 59 deletions

View File

@@ -1342,8 +1342,8 @@ static bool replace_where_subcondition(JOIN *join, Item **expr,
static int subq_sj_candidate_cmp(Item_in_subselect* el1, Item_in_subselect* el2,
void *arg)
{
return (el1->sj_convert_priority > el2->sj_convert_priority) ? 1 :
( (el1->sj_convert_priority == el2->sj_convert_priority)? 0 : -1);
return (el1->sj_convert_priority > el2->sj_convert_priority) ? -1 :
( (el1->sj_convert_priority == el2->sj_convert_priority)? 0 : 1);
}