[MDEV-20273] Add class Item_sum_min_max Created: 2019-08-07  Updated: 2019-08-09  Resolved: 2019-08-07

Status: Closed
Project: MariaDB Server
Component/s: Data types
Fix Version/s: 10.3.18

Type: Task Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-20272 PERCENTILE_DISC() crashes on a tempor... Closed

 Description   

Under terms of this task we'll do the following:

  • Rename the old Item_sum_hybrid to Item_sum_min_max
  • Add a new Item_sum_hybrid like this:

    class Item_sum_hybrid: public Item_sum,
                           public Type_handler_hybrid_field_type
    {
    public:
      Item_sum_hybrid(THD *thd, Item *item_par):
        Item_sum(thd, item_par),
        Type_handler_hybrid_field_type(&type_handler_longlong)
      { collation.set(&my_charset_bin); }
      Item_sum_hybrid(THD *thd, Item *a, Item *b):
        Item_sum(thd, a, b),
        Type_handler_hybrid_field_type(&type_handler_longlong)
      { collation.set(&my_charset_bin); }
      Item_sum_hybrid(THD *thd, Item_sum_hybrid *item)
        :Item_sum(thd, item),
        Type_handler_hybrid_field_type(item)
      { }
      const Type_handler *type_handler() const
      { return Type_handler_hybrid_field_type::type_handler(); }
    };
    

  • Derive Item_sum_min_max from the new Item_sum_hybrid
  • Reuse the new Item_sum_hybrid in Item_sum_hybrid_simple as follows:

    -class Item_sum_hybrid_simple : public Item_sum,
    -                               public Type_handler_hybrid_field_type
    +class Item_sum_hybrid_simple : public Item_sum_hybrid
    

Later, when we fix MDEV-20272, we'll also change Item_sum_percentile_disc (and probably Item_sum_percentile_cont) to be descendants of the new Item_sum_hybrid rather than Item_sum_num.

This expression:

PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY time_column)

should return a TIME value. Therefore the underlying class cannot be a descentand of Item_sum_num (which is supposed to be of a numeric type only).


Generated at Thu Feb 08 08:58:12 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.