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

Split Item_func_between::fix_length_and_dec

    XMLWordPrintable

Details

    Description

      Item_func_between::fix_length_and_dec has the following code:

        if (m_comparator.cmp_type() == STRING_RESULT &&
            agg_arg_charsets_for_comparison(cmp_collation, args, 3))
         return;
       
        /* See the comment about the similar block in Item_bool_func2 */
        if (args[0]->real_item()->type() == FIELD_ITEM &&
            !thd->lex->is_ps_or_view_context_analysis())
        {
          Item_field *field_item= (Item_field*) (args[0]->real_item());
          if (field_item->field_type() ==  MYSQL_TYPE_LONGLONG ||
              field_item->field_type() ==  MYSQL_TYPE_YEAR)
          {
            const bool cvt_arg1= convert_const_to_int(thd, field_item, &args[1]);
            const bool cvt_arg2= convert_const_to_int(thd, field_item, &args[2]);
            if (cvt_arg1 && cvt_arg2)
            {
              // Works for all types
              m_comparator.set_handler(&type_handler_longlong);
            }
          }
        }
      

      It's not friendly for pluggable data type. For example, the INET6 data type will most likely have STRING_RESULT, but it won't need character set and collation aggregation.

      We'll introduce Type_handler::Item_func_between_fix_length_and_dec() and split this code.

      Attachments

        Issue Links

          Activity

            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.