summaryrefslogtreecommitdiff
path: root/sql/item_windowfunc.cc
diff options
context:
space:
mode:
authorVarun Gupta <varunraiko1803@gmail.com>2017-07-10 01:12:56 +0530
committerVarun Gupta <varunraiko1803@gmail.com>2017-11-01 23:13:01 +0530
commit3393005e958de87909ac5fa7f8e6ca92f8cc8b21 (patch)
treef57ded0e820a5fa24f1dc0978d567bc09cf2802f /sql/item_windowfunc.cc
parent275ce39f05c364ca25bb7ecaa6a0bb02df83bdc4 (diff)
downloadmariadb-git-3393005e958de87909ac5fa7f8e6ca92f8cc8b21.tar.gz
Ensured that the the element in the order by clause should have a numerical time, if not throw an error
Diffstat (limited to 'sql/item_windowfunc.cc')
-rw-r--r--sql/item_windowfunc.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/sql/item_windowfunc.cc b/sql/item_windowfunc.cc
index 051dc203ab9..d5e13054755 100644
--- a/sql/item_windowfunc.cc
+++ b/sql/item_windowfunc.cc
@@ -185,6 +185,21 @@ void Item_window_func::split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array,
window_func()->setup_caches(thd);
}
+bool Item_window_func::check_order_list()
+{
+ if (only_single_element_order_list())
+ {
+ Item_result rtype= window_spec->order_list->first->item[0]->result_type();
+ if (rtype != REAL_RESULT && rtype != INT_RESULT &&
+ rtype != DECIMAL_RESULT)
+ {
+ // TODO(varun) please change the error name
+ my_error(ER_WRONG_TYPE_FOR_RANGE_FRAME, MYF(0),"percentile functions");
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
/*
This must be called before attempting to compute the window function values.
@@ -224,6 +239,9 @@ void Item_sum_percentile_disc::setup_window_func(THD *thd, Window_spec *window_s
void Item_sum_percentile_cont::setup_window_func(THD *thd, Window_spec *window_spec)
{
order_item= window_spec->order_list->first->item[0];
+ /* TODO(varun): need to discuss and finalise what type should we
+ return for percentile cont functions
+ */
//set_handler_by_cmp_type(order_item->result_type());
if (!(ceil_value= order_item->get_cache(thd)))
return;