From a1e444e1cc2351c80bbd811a16bf43d8154f4905 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Sat, 19 Aug 2017 20:59:24 -0700 Subject: [PATCH] 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 9c55c64ae32..c614e5c65a4 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 7586bd78fe1..a29fee1641d 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)