diff options
author | Alexander Barkov <bar@mariadb.com> | 2020-06-01 14:30:21 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2020-06-01 14:30:21 +0400 |
commit | 33b839b2e767775d2345caf73ff4eecd155f0518 (patch) | |
tree | 18a756b58418f26e7a05a8745344c946afa8c6a2 /sql | |
parent | f22093ad392b6a7c9906ff97551fc9e1eda8ffa7 (diff) | |
download | mariadb-git-33b839b2e767775d2345caf73ff4eecd155f0518.tar.gz |
MDEV-20280 PERCENTILE_DISC() rejects temporal and string input
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_windowfunc.cc | 7 | ||||
-rw-r--r-- | sql/item_windowfunc.h | 13 |
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); |