Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-20273

Add class Item_sum_min_max

    XMLWordPrintable

    Details

      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).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bar Alexander Barkov
              Reporter:
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: