[MDEV-19283] Move the code from Field_str::is_equal() to Field_string::is_equal() Created: 2019-04-19  Updated: 2019-04-19  Resolved: 2019-04-19

Status: Closed
Project: MariaDB Server
Component/s: Data types
Fix Version/s: 10.4.5

Type: Task Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-17301 Change of COLLATE unnecessarily requi... Closed

 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;
    


Generated at Thu Feb 08 08:50:26 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.