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

Split Item_cache::get_cache() into virtual methods in Type_handler

Details

    Description

      As a part of preparatory work for MDEV-4912, we'll add a new virtual method in Type_handler:

      virtual Item_cache *Item_get_cache(THD *thd, const Item *item) const;
      

      and split this code into implementations of the new virtual method:

      Item_cache* Item_cache::get_cache(THD *thd, const Item *item,
                                        const Item_result type)
      {
        MEM_ROOT *mem_root= thd->mem_root;
        switch (type) {
        case INT_RESULT:
          return new (mem_root) Item_cache_int(thd, item->field_type());
        case REAL_RESULT:
          return new (mem_root) Item_cache_real(thd);
        case DECIMAL_RESULT:
          return new (mem_root) Item_cache_decimal(thd);
        case STRING_RESULT:
          return new (mem_root) Item_cache_str(thd, item);
        case ROW_RESULT:
          return new (mem_root) Item_cache_row(thd);
        case TIME_RESULT:
          return new (mem_root) Item_cache_temporal(thd, item->field_type());
        }
        return 0;                                     // Impossible
      }
      

      This will allow data type plugins to create their own versions of Item_cache, to optimize comparison with constants.

      Attachments

        Issue Links

          Activity

            bar Alexander Barkov created issue -
            bar Alexander Barkov made changes -
            Field Original Value New Value
            Description As a part of preparatory work for MDEV-4912, we'll add a new virtual method in Type_handler:
            {code:cpp}
            virtual Item_cache *Item_get_cache(THD *thd, const Item *item) const;
            {code}
            and split this code into implementations of the new virtual method:
            {code:cpp}
            Item_cache* Item_cache::get_cache(THD *thd, const Item *item,
                                              const Item_result type)
            {
              MEM_ROOT *mem_root= thd->mem_root;
              switch (type) {
              case INT_RESULT:
                return new (mem_root) Item_cache_int(thd, item->field_type());
              case REAL_RESULT:
                return new (mem_root) Item_cache_real(thd);
              case DECIMAL_RESULT:
                return new (mem_root) Item_cache_decimal(thd);
              case STRING_RESULT:
                return new (mem_root) Item_cache_str(thd, item);
              case ROW_RESULT:
                return new (mem_root) Item_cache_row(thd);
              case TIME_RESULT:
                return new (mem_root) Item_cache_temporal(thd, item->field_type());
              }
              return 0; // Impossible
            }
            {code}
            As a part of preparatory work for MDEV-4912, we'll add a new virtual method in Type_handler:
            {code:cpp}
            virtual Item_cache *Item_get_cache(THD *thd, const Item *item) const;
            {code}
            and split this code into implementations of the new virtual method:
            {code:cpp}
            Item_cache* Item_cache::get_cache(THD *thd, const Item *item,
                                              const Item_result type)
            {
              MEM_ROOT *mem_root= thd->mem_root;
              switch (type) {
              case INT_RESULT:
                return new (mem_root) Item_cache_int(thd, item->field_type());
              case REAL_RESULT:
                return new (mem_root) Item_cache_real(thd);
              case DECIMAL_RESULT:
                return new (mem_root) Item_cache_decimal(thd);
              case STRING_RESULT:
                return new (mem_root) Item_cache_str(thd, item);
              case ROW_RESULT:
                return new (mem_root) Item_cache_row(thd);
              case TIME_RESULT:
                return new (mem_root) Item_cache_temporal(thd, item->field_type());
              }
              return 0; // Impossible
            }
            {code}

            This will allow data type plugins to create their own versions of Item_cache, to optimize comparison with constants.

            bar Alexander Barkov made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            bar Alexander Barkov made changes -
            Status In Progress [ 3 ] Stalled [ 10000 ]
            bar Alexander Barkov made changes -
            Status Stalled [ 10000 ] In Progress [ 3 ]
            bar Alexander Barkov made changes -
            bar Alexander Barkov made changes -
            Assignee Alexander Barkov [ bar ] Oleksandr Byelkin [ sanja ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            bar Alexander Barkov made changes -
            Assignee Oleksandr Byelkin [ sanja ] Alexander Barkov [ bar ]
            bar Alexander Barkov made changes -
            Status In Review [ 10002 ] Stalled [ 10000 ]

            Reviewed and approved by Sanja.

            bar Alexander Barkov added a comment - Reviewed and approved by Sanja.
            bar Alexander Barkov made changes -
            Fix Version/s 10.3.0 [ 22127 ]
            Fix Version/s 10.3 [ 22126 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            bar Alexander Barkov made changes -
            Labels datatype
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 78459 ] MariaDB v4 [ 133010 ]

            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.