summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/item_windowfunc.cc7
-rw-r--r--sql/item_windowfunc.h13
2 files changed, 12 insertions, 8 deletions
diff --git a/sql/item_windowfunc.cc b/sql/item_windowfunc.cc
index f20d20c81d6..acf2ee4fdda 100644
--- a/sql/item_windowfunc.cc
+++ b/sql/item_windowfunc.cc
@@ -187,13 +187,6 @@ bool Item_window_func::check_result_type_of_order_item()
case Item_sum::PERCENTILE_DISC_FUNC:
{
Item *src_item= window_spec->order_list->first->item[0];
- Item_result rtype= src_item->cmp_type();
- // TODO-10.5: Fix MDEV-20280 PERCENTILE_DISC() rejects temporal and string input
- if (rtype != REAL_RESULT && rtype != INT_RESULT && rtype != DECIMAL_RESULT)
- {
- my_error(ER_WRONG_TYPE_FOR_PERCENTILE_FUNC, MYF(0), window_func()->func_name());
- return true;
- }
Item_sum_percentile_disc *func=
static_cast<Item_sum_percentile_disc*>(window_func());
func->set_handler(src_item->type_handler());
diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h
index f38209e4bb5..c3304122c1b 100644
--- a/sql/item_windowfunc.h
+++ b/sql/item_windowfunc.h
@@ -779,12 +779,23 @@ public:
if (get_row_count() == 0 || get_arg(0)->is_null())
{
null_value= true;
- return 0;
+ return true;
}
null_value= false;
return value->get_date(thd, ltime, fuzzydate);
}
+ bool val_native(THD *thd, Native *to)
+ {
+ if (get_row_count() == 0 || get_arg(0)->is_null())
+ {
+ null_value= true;
+ return true;
+ }
+ null_value= false;
+ return value->val_native(thd, to);
+ }
+
bool add()
{
Item *arg= get_arg(0);