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

Move the code from Field_str::is_equal() to Field_string::is_equal()

Details

    Description

      Field_str in an abstract class with this hierarchy:

      Field_str                        [*]
        Field_longstr
          Field_string
          Field_varstring              [*]
            Field_varstring_compressed
          Field_blob                   [*]
            Field_blob_compressed
            Field_geom                 [*]
        Field_null
          Field_row
        Field_enum                     [*]
          Field_set
      

      [*] marks classes that their own virtual is_equal() implementation.

      Most Field_str descendants completeley override is_equal() and do not share the implementation on the Field_str level.

      Only Field_string and Field_null share Field_str::is_equal().
      If we take a look inside Field_str::is_equal(), it actually implements behavior for CHAR.

      Under term of this task we'll:

      • Move the code from Field_str::is_equal() to Field_string::is_equal()
      • Override Field_null::is_equal() to a simple implementation. The current shared implementation is too exsessive for Field_null, and is going to be even more complex under terms of MDEV-17301. It can be simplified to something like this:

        uint Field_null::is_equal(Create_field *new_field)
        {
          DBUG_ASSERT(!compression_method());
          return new_field->type_handler() == type_handler() &&
                 new_field->charset == field_charset &&
                 new_field->length == max_display_length();
        }
        

      • Remove the default unused implementation Field::is_equal() and define it as a zero pointer:

        virtual uint is_equal(Create_field *new_field)= 0;
        

      Attachments

        Issue Links

          Activity

            bar Alexander Barkov created issue -
            bar Alexander Barkov made changes -
            Field Original Value New Value
            bar Alexander Barkov made changes -
            Description Field_str in an abstract class with this hierarchy:

            {noformat}
            Field_str [*]
              Field_longstr
                Field_string
                Field_varstring [*]
                  Field_varstring_compressed
                Field_blob [*]
                  Field_blob_compressed
                  Field_geom [*]
              Field_null
                Field_row
              Field_enum [*]
                Field_set
            {noformat}

            {{[*]}} marks classes that their own virtual {{is_equal()}} implementation.

            Most {{Field_str}} descendants completeley override {{is_equal()}} and do not share the implementation on the {{Field_str}} level.

            Only {{Field_string}} and {{Field_null}} share {{Field_str::is_equal()}}.
            If we take a look inside {{Field_str::is_equal()}}, it actually implements behavior for {{CHAR}}.

            Under term of this task we'll:

            - Move the code from {{Field_str::is_equal()}} to {{Field_string::is_equal()}}
            - Override {{Field_null::is_equal()}} to a simple implementation. The current shared implementation is too exsessive for {{Field_null}}, and is going to be even more complex under terms of MDEV-17301. It can be simplified to something like this:
            {code:sql}
            uint Field_null::is_equal(Create_field *new_field)
            {
              DBUG_ASSERT(!compression_method());
              return new_field->type_handler() == type_handler() &&
                     new_field->charset == field_charset &&
                     new_field->length == max_display_length();
            }
            {code}
            Field_str in an abstract class with this hierarchy:

            {noformat}
            Field_str [*]
              Field_longstr
                Field_string
                Field_varstring [*]
                  Field_varstring_compressed
                Field_blob [*]
                  Field_blob_compressed
                  Field_geom [*]
              Field_null
                Field_row
              Field_enum [*]
                Field_set
            {noformat}

            {{[*]}} marks classes that their own virtual {{is_equal()}} implementation.

            Most {{Field_str}} descendants completeley override {{is_equal()}} and do not share the implementation on the {{Field_str}} level.

            Only {{Field_string}} and {{Field_null}} share {{Field_str::is_equal()}}.
            If we take a look inside {{Field_str::is_equal()}}, it actually implements behavior for {{CHAR}}.

            Under term of this task we'll:

            - Move the code from {{Field_str::is_equal()}} to {{Field_string::is_equal()}}
            - Override {{Field_null::is_equal()}} to a simple implementation. The current shared implementation is too exsessive for {{Field_null}}, and is going to be even more complex under terms of MDEV-17301. It can be simplified to something like this:
            {code:sql}
            uint Field_null::is_equal(Create_field *new_field)
            {
              DBUG_ASSERT(!compression_method());
              return new_field->type_handler() == type_handler() &&
                     new_field->charset == field_charset &&
                     new_field->length == max_display_length();
            }
            {code}
            - Remove the default unused implementation {{Field::is_equal()}} and define it as a zero pointer:
            {code:sql}
            virtual uint is_equal(Create_field *new_field)= 0;
            {code}
            bar Alexander Barkov made changes -
            issue.field.resolutiondate 2019-04-19 03:54:44.0 2019-04-19 03:54:44.315
            bar Alexander Barkov made changes -
            Fix Version/s 10.4.5 [ 23311 ]
            Fix Version/s 10.4 [ 22408 ]
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 96209 ] MariaDB v4 [ 133934 ]

            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.