[MDEV-14630] Replace {STRING|INT|REAL|DECIMAL|DATE}_ITEM to CONST_ITEM Created: 2017-12-12  Updated: 2020-05-05  Resolved: 2018-06-06

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

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

Issue Links:
Blocks
blocks MDEV-4912 Data type plugin API version 1 Closed
blocks MDEV-15654 ADDTIME creates invalid timestamp val... Closed
is blocked by MDEV-15597 Add class Load_data_outvar and avoid ... Closed
is blocked by MDEV-15689 Fix Item_func_set_collation to pass t... Closed
is blocked by MDEV-15702 Remove the use of STRING_ITEM from It... Closed
is blocked by MDEV-15714 Remove the use of STRING_ITEM from th... Closed
is blocked by MDEV-16309 Split ::create_tmp_field() into virtu... Closed
is blocked by MDEV-16316 Replace INT_ITEM references in the co... Closed
is blocked by MDEV-16320 Replace INT_ITEM references in sql_se... Closed
is blocked by MDEV-16379 Move Item_basic_const::used_table_map... Closed
is blocked by MDEV-16388 Replace member Item::fixed to virtual... Closed
is blocked by MDEV-16408 Remove tests for Item::type() in Item... Closed

 Description   

The enumeration Item::Type has data-type specific constants for literals:

  • STRING_ITEM
  • INT_ITEM
  • REAL_ITEM
  • DECIMAL_ITEM
  • DATE_ITEM

This is not friendly to upcoming data type plugins, as they'll need to create their own literals.

We'll do the following:

  • Remove the data type specific enumeration values from Item::Type
  • Add a new value CONST_ITEM
  • Fix the calling code to test for CONST_ITEM, and when it is necessary, detect the data type using other means, such as type_handler(), or by adding new virtual methods into Item or its descendants.

Note, under terms of this task, we'll preserve the old behavior. For example, Item_param::type() (when assigned to an integer value), reports itself as INT_ITEM. This makes parameter work as a position rather than an expression when used in ORDER BY:

  if (order_item->type() == Item::INT_ITEM && order_item->basic_const_item() &&
      !from_window_spec)

This behavior was most likely introduced as a side effect. The new implementation will preserve the old behavior, including side effects like this.


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