[Commits] a1e444e: Corrected the function compare_order_elements() to make it

IgorBabaev igor at mariadb.com
Sun Aug 20 06:59:24 EEST 2017


revision-id: a1e444e1cc2351c80bbd811a16bf43d8154f4905 (mariadb-10.2.2-604-ga1e444e)
parent(s): d7b45e01b47b11daf21af9e68ad762f3a70b915c
author: Igor Babaev
committer: Igor Babaev
timestamp: 2017-08-19 20:59:24 -0700
message:

Corrected the function compare_order_elements() to make it
platform independent.

---
 mysql-test/r/derived_cond_pushdown.result | 4 ++--
 sql/sql_window.cc                         | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/mysql-test/r/derived_cond_pushdown.result b/mysql-test/r/derived_cond_pushdown.result
index 9c55c64..c614e5c 100644
--- a/mysql-test/r/derived_cond_pushdown.result
+++ b/mysql-test/r/derived_cond_pushdown.result
@@ -9458,10 +9458,10 @@ EXPLAIN
           "window_functions_computation": {
             "sorts": {
               "filesort": {
-                "sort_key": "t2.c"
+                "sort_key": "t2.a, t2.c"
               },
               "filesort": {
-                "sort_key": "t2.a, t2.c"
+                "sort_key": "t2.c"
               }
             },
             "temporary_table": {
diff --git a/sql/sql_window.cc b/sql/sql_window.cc
index 7586bd7..a29fee1 100644
--- a/sql/sql_window.cc
+++ b/sql/sql_window.cc
@@ -405,7 +405,8 @@ int compare_order_elements(ORDER *ord1, ORDER *ord2)
   Item *item2= (*ord2->item)->real_item();
   DBUG_ASSERT(item1->type() == Item::FIELD_ITEM &&
               item2->type() == Item::FIELD_ITEM); 
-  int cmp= ((Item_field *) item1)->field - ((Item_field *) item2)->field;
+  int cmp= ((Item_field *) item1)->field->field_index -
+           ((Item_field *) item2)->field->field_index;
   if (cmp == 0)
   {
     if (ord1->direction == ord2->direction)


More information about the commits mailing list