diff options
author | Igor Babaev <igor@askmonty.org> | 2016-04-01 12:00:54 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2016-04-01 12:00:54 -0700 |
commit | 2e4bd4407ed73b45d017ef160b2964aff1af7c6f (patch) | |
tree | 2e74304f4969089ec8f9ffa08cc893e256eee37d /sql/opt_table_elimination.cc | |
parent | c9ff5cfbfdf81f5ca547b97ea6d96f1b308e6f48 (diff) | |
download | mariadb-git-2e4bd4407ed73b45d017ef160b2964aff1af7c6f.tar.gz |
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.
Diffstat (limited to 'sql/opt_table_elimination.cc')
-rw-r--r-- | sql/opt_table_elimination.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc index 912ef4a7df7..6835594ca07 100644 --- a/sql/opt_table_elimination.cc +++ b/sql/opt_table_elimination.cc @@ -1105,7 +1105,7 @@ int compare_field_values(Dep_value_field *a, Dep_value_field *b, void *unused) uint b_ratio= b->field->table->tablenr*MAX_FIELDS + b->field->field_index; - return (a_ratio < b_ratio)? -1 : ((a_ratio == b_ratio)? 0 : 1); + return (a_ratio < b_ratio)? 1 : ((a_ratio == b_ratio)? 0 : -1); } |