Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
Description
Item_func_min_max::fix_length_and_dec() is hard-coded for the built-in data types. To allow pluggable data type determine behavior of the functions LEAST and GREATEST, we'll move the code to Type_handler as follows:
1. Add a new method in Type_handler_hybrid_field_type:
bool aggregate_for_min_max(const char *funcname, Item **items, uint nitems); |
This method will decide which data type handler should be used for the result of LEAST/GREATEST.
2. Add a new virtual method in Type_handler:
virtual bool Item_func_min_max_fix_attributes(THD *thd, |
Item_func_min_max *func,
|
Item **items,
|
uint nitems) const; |
This method will calculate the data type attributes. See Type_std_attributes.
Note, implementations for the particular Type_handler_xxx classes should reuse the code from Item_hybrid_func_fix_attributes as much as possible, because the current implementation of Item_func_min_max::fix_length_and_dec() is quite buggy:
MDEV-12497Wrong data type for LEAST(latin1_expr, utf8_expr)MDEV-12504Wrong data type for LEAST(date_expr,time_expr)MDEV-12505Wrong data type for GREATEST(bit_column, int_column)
Sharing the code with Item_hybrid_func should fix these problems.
3. Remove the current implementation of Item_func_min_max::fix_length_and_dec() and replace it to the new methods.
Under terms of this task we'll also disallow LEAST and GREATEST to have arguments of the GEOMETRY data type mixed with numeric and temporal arguments, as this has no sense.
Attachments
Issue Links
- blocks
-
MDEV-4912 Data type plugin API version 1
- Closed
- relates to
-
MDEV-12497 Wrong data type for LEAST(latin1_expr, utf8_expr)
- Closed
-
MDEV-12504 Wrong data type for LEAST(date_expr,time_expr)
- Closed
-
MDEV-12505 Wrong data type for GREATEST(bit_column, int_column)
- Closed