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

Split Item_func_hybrid_field_type::val_xxx() into methods in Type_handler

Details

    Description

      Under term of this tasks we'll remove switch(cmp_type()) in Item_func_hybrid_field_type::val_xxx() and Item_func_hybrid_field_type::get_date() and introduce instead new methods in Type_handler, e.g.:

      class Type_handler
      {
        ...
        virtual
        String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *,
                                                      String *) const= 0;};
      }
      

      The methods Item_func_hybrid_field_type::val_xxx() and Item_func_hybrid_field_type::get_date() will call the corresponding new methods in Type_handler:

      class Item_func_hybrid_field_type: public Item_hybrid_func
      {
        ...
        String *val_str(String*str)
        {
          return Item_func_hybrid_field_type::type_handler()->
                     Item_func_hybrid_field_type_val_str(this, str);
        }
        ...
      }
      

      For performance purposes, the change should try not to introduce new virtual calls.
      One virtual call in switch(cmp_type()) should be replaced to one virtual call in Type_handler.
      Calls inside the new methods in Type_handler should be done statically.

      Attachments

        Issue Links

          Activity

            I've also reviewed MDEV-10811 in the process of reviewing this patch. After discussing not to use casts that lead to undefined behaviour, we've agreed on an implementation.

            cvicentiu Vicențiu Ciorbaru added a comment - I've also reviewed MDEV-10811 in the process of reviewing this patch. After discussing not to use casts that lead to undefined behaviour, we've agreed on an implementation.

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.