Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.3(EOL)
Description
Item_sum_hybrid::fix_fields has a code to fix the data type and its attributes:
Item_sum_hybrid::fix_fields(THD *thd, Item **ref) |
{
|
...
|
Type_std_attributes::set(args[0]);
|
...
|
Item *item2= item->real_item();
|
if (item2->type() == Item::FIELD_ITEM) |
set_handler_by_field_type(((Item_field*) item2)->field->type());
|
else if (item->cmp_type() == TIME_RESULT) |
set_handler_by_field_type(item2->field_type());
|
else |
set_handler_by_result_type(item2->result_type(),
|
max_length, collation.collation);
|
switch (Item_sum_hybrid::result_type()) { |
case INT_RESULT: |
case DECIMAL_RESULT: |
case STRING_RESULT: |
break; |
case REAL_RESULT: |
max_length= float_length(decimals);
|
break; |
case ROW_RESULT: |
case TIME_RESULT: |
DBUG_ASSERT(0);
|
};
|
setup_hybrid(thd, args[0], NULL);
|
/* MIN/MAX can return NULL for empty set indepedent of the used column */ |
maybe_null= 1;
|
result_field=0;
|
null_value=1;
|
fix_length_and_dec();
|
...
|
}
|
This task will introduce a new virtual method in Type_handler:
bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const; |
and move pieces of the above fragment to relevant implementations of Type_handler_xxx.
The above fragment in Item_sum_hybrid::fix_fields() will be replaced to a call of the new method:
args[0]->type_handler()->Item_sum_hybrid_fix_length_and_dec(this); |
Attachments
Issue Links
- blocks
-
MDEV-4912 Data type plugin API version 1
- Closed