summaryrefslogtreecommitdiff
path: root/sql/sql_window.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-04-25 09:05:52 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-04-25 09:05:52 +0300
commitacf6f92aa936fbfe7524617ae57d011ab8f1f96d (patch)
treee7fc2258c06a0fdab1cce115de4d71a091d82d28 /sql/sql_window.cc
parent765ae6e82165d1bc4cf6cc9f0d556d66a5e172d1 (diff)
parentbc145193c164b895a52b943e73fff53952d48a60 (diff)
downloadmariadb-git-acf6f92aa936fbfe7524617ae57d011ab8f1f96d.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'sql/sql_window.cc')
-rw-r--r--sql/sql_window.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/sql/sql_window.cc b/sql/sql_window.cc
index dcc6a7bac1c..86c40b5f58f 100644
--- a/sql/sql_window.cc
+++ b/sql/sql_window.cc
@@ -455,6 +455,22 @@ int compare_order_lists(SQL_I_List<ORDER> *part_list1,
for ( ; elem1 && elem2; elem1= elem1->next, elem2= elem2->next)
{
int cmp;
+ // remove all constants as we don't need them for comparision
+ while(elem1 && ((*elem1->item)->real_item())->const_item())
+ {
+ elem1= elem1->next;
+ continue;
+ }
+
+ while(elem2 && ((*elem2->item)->real_item())->const_item())
+ {
+ elem2= elem2->next;
+ continue;
+ }
+
+ if (!elem1 || !elem2)
+ break;
+
if ((cmp= compare_order_elements(elem1, elem2)))
return cmp;
}