summaryrefslogtreecommitdiff
path: root/sql/item_windowfunc.cc
diff options
context:
space:
mode:
authorVarun Gupta <varunraiko1803@gmail.com>2017-06-26 02:15:19 +0530
committerVarun Gupta <varunraiko1803@gmail.com>2017-11-01 23:13:01 +0530
commit18747a4baa9cc68766eaa7a40e92f8c3d873631a (patch)
tree172c5d732cbf99b62afe71f4fd379713f07f9576 /sql/item_windowfunc.cc
parent129626f171377c247b71bdda602a554829e4f848 (diff)
downloadmariadb-git-18747a4baa9cc68766eaa7a40e92f8c3d873631a.tar.gz
Added value field to Item_sum_percentile_disc
Check for single element in the order_list is added
Diffstat (limited to 'sql/item_windowfunc.cc')
-rw-r--r--sql/item_windowfunc.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/sql/item_windowfunc.cc b/sql/item_windowfunc.cc
index 835a3cbfdae..50a8c5d82cd 100644
--- a/sql/item_windowfunc.cc
+++ b/sql/item_windowfunc.cc
@@ -108,6 +108,17 @@ Item_window_func::fix_fields(THD *thd, Item **ref)
my_error(ER_NO_ORDER_LIST_IN_WINDOW_SPEC, MYF(0), window_func()->func_name());
return true;
}
+
+ if (only_single_element_order_list())
+ {
+ // need to change the error, the error should say that we have more than one element in the order list
+ if (window_spec->order_list->elements != 1)
+ {
+ my_error(ER_NO_ORDER_LIST_IN_WINDOW_SPEC, MYF(0), window_func()->func_name());
+ return true;
+ }
+ }
+
/*
TODO: why the last parameter is 'ref' in this call? What if window_func
decides to substitute itself for something else and does *ref=.... ?
@@ -194,6 +205,11 @@ void Item_sum_dense_rank::setup_window_func(THD *thd, Window_spec *window_spec)
clear();
}
+void Item_sum_percentile_disc::setup_window_func(THD *thd, Window_spec *window_spec)
+{
+ setup_percentile_func(thd, window_spec->order_list);
+}
+
bool Item_sum_dense_rank::add()
{
if (peer_tracker->check_if_next_group() || first_add)