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

Split Item_func_hex::val_str_ascii() into virtual methods in Type_handler

Details

    Description

      Item_func_hex::val_str_ascii() has a few tests on args[0]->result_type().

         if (args[0]->result_type() == REAL_RESULT ||
             args[0]->result_type() == DECIMAL_RESULT)
      

      We'll move the data type specific code to the corresponding Type_handler_xxx, and rewrite Item_func_hex::val_str_ascii() to call a virtual method in Type_handler, e.g. about like this:

       String *val_str_ascii(String *str)
       {
         return args[0]->type_handler()->Item_func_hex_val_str_ascii(this, str);
       }
      

      Note, the value of args[0]->type_handler() can be cached at fix_length_and_dec() time, to have fewer virtual calls at run time:

       String *val_str_ascii(String *str)
       {
         return m_handler->Item_func_hex_val_str_ascii(this, str);
       }
      

      Attachments

        Issue Links

          Activity

            bar Alexander Barkov created issue -
            bar Alexander Barkov made changes -
            Field Original Value New Value
            bar Alexander Barkov made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            bar Alexander Barkov made changes -
            Description {{Item_func_hex::val_str_ascii()}} has a few tests on {{args[0]->result_type()}}.
            {code}
               if (args[0]->result_type() == REAL_RESULT ||
                   args[0]->result_type() == DECIMAL_RESULT)
            {code}

            We'll move the data type specific code to the corresponding {{Type_handler_xxx}}, and rewrite {{Item_func_hex::val_str_ascii()}} to call a virtual method in {{Type_handler}}, e.g. about like this:
            {code}
             String *val_str_ascii(String *str)
             {
               return args[0]->type_handler()->Item_func_hex_val_str_ascii(this, str);
             }
            {code}

            Note, the value of {{args[0]->type_handler()}} can be cached at {{fix_length_and_dec()}} time, to less fewer virtual calls at run time:

            {code}
             String *val_str_ascii(String *str)
             {
               return m_handler->Item_func_hex_val_str_ascii(this, str);
             }
            {code}
            {{Item_func_hex::val_str_ascii()}} has a few tests on {{args[0]->result_type()}}.
            {code:cpp}
               if (args[0]->result_type() == REAL_RESULT ||
                   args[0]->result_type() == DECIMAL_RESULT)
            {code}

            We'll move the data type specific code to the corresponding {{Type_handler_xxx}}, and rewrite {{Item_func_hex::val_str_ascii()}} to call a virtual method in {{Type_handler}}, e.g. about like this:
            {code:cpp}
             String *val_str_ascii(String *str)
             {
               return args[0]->type_handler()->Item_func_hex_val_str_ascii(this, str);
             }
            {code}

            Note, the value of {{args[0]->type_handler()}} can be cached at {{fix_length_and_dec()}} time, to less fewer virtual calls at run time:

            {code:cpp}
             String *val_str_ascii(String *str)
             {
               return m_handler->Item_func_hex_val_str_ascii(this, str);
             }
            {code}
            bar Alexander Barkov made changes -
            Description {{Item_func_hex::val_str_ascii()}} has a few tests on {{args[0]->result_type()}}.
            {code:cpp}
               if (args[0]->result_type() == REAL_RESULT ||
                   args[0]->result_type() == DECIMAL_RESULT)
            {code}

            We'll move the data type specific code to the corresponding {{Type_handler_xxx}}, and rewrite {{Item_func_hex::val_str_ascii()}} to call a virtual method in {{Type_handler}}, e.g. about like this:
            {code:cpp}
             String *val_str_ascii(String *str)
             {
               return args[0]->type_handler()->Item_func_hex_val_str_ascii(this, str);
             }
            {code}

            Note, the value of {{args[0]->type_handler()}} can be cached at {{fix_length_and_dec()}} time, to less fewer virtual calls at run time:

            {code:cpp}
             String *val_str_ascii(String *str)
             {
               return m_handler->Item_func_hex_val_str_ascii(this, str);
             }
            {code}
            {{Item_func_hex::val_str_ascii()}} has a few tests on {{args[0]->result_type()}}.
            {code:cpp}
               if (args[0]->result_type() == REAL_RESULT ||
                   args[0]->result_type() == DECIMAL_RESULT)
            {code}

            We'll move the data type specific code to the corresponding {{Type_handler_xxx}}, and rewrite {{Item_func_hex::val_str_ascii()}} to call a virtual method in {{Type_handler}}, e.g. about like this:
            {code:cpp}
             String *val_str_ascii(String *str)
             {
               return args[0]->type_handler()->Item_func_hex_val_str_ascii(this, str);
             }
            {code}

            Note, the value of {{args[0]->type_handler()}} can be cached at {{fix_length_and_dec()}} time, to have fewer virtual calls at run time:

            {code:cpp}
             String *val_str_ascii(String *str)
             {
               return m_handler->Item_func_hex_val_str_ascii(this, str);
             }
            {code}
            bar Alexander Barkov made changes -
            Assignee Alexander Barkov [ bar ] Alexey Botchkov [ holyfoot ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            holyfoot Alexey Botchkov made changes -
            Status In Review [ 10002 ] Stalled [ 10000 ]
            holyfoot Alexey Botchkov made changes -
            Assignee Alexey Botchkov [ holyfoot ] Alexander Barkov [ bar ]
            bar Alexander Barkov made changes -
            Status Stalled [ 10000 ] In Progress [ 3 ]
            bar Alexander Barkov made changes -
            issue.field.resolutiondate 2016-12-01 07:59:12.0 2016-12-01 07:59:12.394
            bar Alexander Barkov made changes -
            Fix Version/s 10.3.0 [ 22127 ]
            Fix Version/s 10.3 [ 22126 ]
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]
            bar Alexander Barkov made changes -
            Labels datatype
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 78323 ] MariaDB v4 [ 133003 ]

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.