[MDEV-9215] Detect cmp_type() and result_type() from field_type() Created: 2015-12-01  Updated: 2017-05-17  Resolved: 2017-05-17

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Fix Version/s: 10.3.1

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

Issue Links:
Blocks
blocks MDEV-4912 Data type plugin API version 1 Closed
Relates
relates to MDEV-12718 Determine Item::cmp_type() from Item:... Closed

 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


 Comments   
Comment by Alexander Barkov [ 2017-05-17 ]

All tasks mentioned here were solved by a number of other MDEV-4912 dependency tasks, e.g. MDEV-12718

Generated at Thu Feb 08 07:33:00 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.