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

Detect cmp_type() and result_type() from field_type()

    Details

      Description

      Currently many items define its result_type() and then calculate field_type() and cmp_type() from result_type().

      We'll change this to have items define its field_type(), while result_type() and cmp_type() will be calculated from field_type().

      The change will consists of the following parts:
      1. Changes in simple cases:

      • Remove the default implementation of Item::cmp_type() and change the simple items (with non-hybrid types) to calculate cmp_type() from field_type():

         Item_result cmp_type() const { return type_handler()->cmp_type(); }

      • Change the default implementation of Item::result_type() to detect the value by field_type(), instead of returning REAL_RESULT.
      • Remove the default implementation of Item::field_type() and Implement field_type() for all Items that currently do not have it.
        The top level Item::field_type() will be pure virtual.

         Item_result result_type() const { return type_handler()->result_type(); }

      • Rename the top-level Item::field_type() into a non-virtual Item::field_type_by_result_type(). It's still needed for Item_sum_sum, and will be removed in a later step.

      2. Changes in Item_sum_sum:

      • Remove Item_sum_sum::hybrid_type
      • Derive Item_sum_sum from Type_handler_hybrid_field_type instead.
      • Remove Item::field_type_by_result_type(), as it's not needed any more.

      3. Changes in Item_splocal

      • Remove Item_splocal::m_field_type and Item_splocale::m_result_type.
      • Derive Item_splocal from Type_handler_hybrid_field_type instead.

      4. Changes in Item_temporal_func

      • Remove Item_temporal_hybrid_func::cached_field_type
      • Derive Item_temporal_hybrid_func from Type_handler_hybrid_field_type

      5. Changes in Item_param

      • Remove Item_param::param_type and Item_param::item_result_type
      • Derive Item_param from Type_handler_hybrid_field_type

      6. Changes in Item_type_holder

      • Remove Item_type_holder::fld_type
      • Add type handlers for all missing possible Field::real_type() values. Note: we have had handlers for all field_type() values only so far.
      • Add Type_handler_hybrid_real_field_type, derived from Type_handler_hybrid_field_type
      • Derive Item_type_holder from Type_handler_hybrid_real_field_type

      7. Canges in Item_cache

      • Remove Item_cache::cached_field_type
      • Derive Item_cache from Type_handler_hybrid_field_type

      8. Changes in Item_copy

      • Remove Item_copy::cached_field_type and Item_copy::cached_result_type
      • Derive Item_copy from Type_handler_hybrid_field_type

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bar Alexander Barkov
                Reporter:
                bar Alexander Barkov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: