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

Change Item::with_sum_func from a member to a virtual method

    XMLWordPrintable

    Details

      Description

      This task is similar to what we did earlier for Item::with_subselect (see MDEV-14517).

      It's hard to track in the code which Item classes in the hierarchy:

      • have always with_sum_func==true
      • have always with_sum_func==false
      • have variable with_sum_func

      Under terms of this task we'll remove the member Item::with_sum_func and add a method instead:

      virtual bool with_sum_func() const { return false; }
      

      Item_sum will override this method as follows:

      bool with_sum_func() const { return true; }
      

      Only a few Item classes need a variable "with_sum_func" value:

      • Item_ref
      • Item_cache_wrapper
      • Item_func
      • Item_row
      • Item_subselect

      They'll store the "with_sum_func" value in a member, using a simple shared class With_sum_func_cache, which they will derive from.

      Rationale:

      • The code will be easier to read this way (instead of searching for all possible assignments of the member with_sum_func, one can just find who overrides the method)
      • Also, Item types that do not need a variable "with_sum_func" will become potentially smaller in size (when alignment allows)

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: