[Commits] f2033df: More thorough correction of the patch that complemented the patch for mdev-10855

IgorBabaev igor at mariadb.com
Fri Aug 25 06:49:07 EEST 2017


revision-id: f2033df6ac0f64664d9aad2d56fdd74f4bf9d666 (mariadb-10.2.2-607-gf2033df)
parent(s): 0336655918d62cbbc817cbb03d785081e9df1a05
author: Igor Babaev
committer: Igor Babaev
timestamp: 2017-08-24 20:49:07 -0700
message:

More thorough correction of the patch that complemented the patch for mdev-10855

---
 sql/sql_window.cc | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/sql/sql_window.cc b/sql/sql_window.cc
index 40197be..33e5464 100644
--- a/sql/sql_window.cc
+++ b/sql/sql_window.cc
@@ -334,12 +334,12 @@ ORDER *st_select_lex::find_common_window_func_partition_fields(THD *thd)
   Item *item;
   DBUG_ASSERT(window_funcs.elements);
   List_iterator_fast<Item_window_func> it(window_funcs);
-  Item_window_func *wf= it++;
-  if (!wf->window_spec->partition_list)
+  Item_window_func *first_wf= it++;
+  if (!first_wf->window_spec->partition_list)
     return 0;
   List<Item> common_fields;
   uint first_partition_elements= 0;
-  for (ord= wf->window_spec->partition_list->first; ord; ord= ord->next)
+  for (ord= first_wf->window_spec->partition_list->first; ord; ord= ord->next)
   {
     if ((*ord->item)->real_item()->type() == Item::FIELD_ITEM)
       common_fields.push_back(*ord->item, thd->mem_root);
@@ -347,8 +347,9 @@ ORDER *st_select_lex::find_common_window_func_partition_fields(THD *thd)
   }
   if (window_specs.elements == 1 &&
       common_fields.elements == first_partition_elements)
-    return wf->window_spec->partition_list->first;
+    return first_wf->window_spec->partition_list->first;
   List_iterator<Item> li(common_fields);
+  Item_window_func *wf;
   while (common_fields.elements && (wf= it++))
   {
     if (!wf->window_spec->partition_list)
@@ -368,11 +369,9 @@ ORDER *st_select_lex::find_common_window_func_partition_fields(THD *thd)
   if (!common_fields.elements)
     return 0;
   if (common_fields.elements == first_partition_elements)
-    return wf->window_spec->partition_list->first;
+    return first_wf->window_spec->partition_list->first;
   SQL_I_List<ORDER> res_list;
-  it.rewind();
-  wf= it++;
-  for (ord= wf->window_spec->partition_list->first, item= li++;
+  for (ord= first_wf->window_spec->partition_list->first, item= li++;
        ord; ord= ord->next)
   {
     if (item != *ord->item)


More information about the commits mailing list