mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-11503 Introduce Type_handler::make_in_vector() and Item_func_in_fix_comparator_compatible_types()
This patch implements the task according to the description: 1. The old code from Item_func_in::fix_length_and_dec() was decomposed into smaller methods: - all_items_are_consts() - compatible_types_scalar_bisection_possible() - compatible_types_row_bisection_possible() - fix_in_vector() - fix_for_scalar_comparison_using_bisection() - fix_for_scalar_comparison_using_cmp_items() - fix_for_row_comparison_using_bisection() - fix_for_row_comparison_using_cmp_items() The data type dependend pieces where moved as methods to Type_handler. 2. Splits in_datetime into separate: - in_datetime, for DATETIME and DATE, - in_time, for TIME to make the code more symmetric across data types. Additionally: - Adds a test func_debug.test to see which calculation strategy (bisect or no bisect) is chosen to handle IN with various arguments. - Adds a new helper method (to avoid duplicate code): cmp_item_rows::prepare_comparators() - Changes the propotype for cmp_item_row::alloc_comparators(), to avoid duplicate code, and to use less current_thd. - Changes "friend" sections in cmp_item_row and in_row from an exact Item_func_in method to the entire class Item_func_in, as their internals are now needed in multiple Item_func_in methods. - Added more comments (e.g. on bisection, on the problem reported in MDEV-11511)
This commit is contained in:
@ -30,6 +30,8 @@ class Item_sum_hybrid;
|
||||
class Item_func_hex;
|
||||
class Item_func_hybrid_field_type;
|
||||
class Item_func_between;
|
||||
class Item_func_in;
|
||||
class in_vector;
|
||||
class Type_std_attributes;
|
||||
class Sort_param;
|
||||
class Arg_comparator;
|
||||
@ -317,6 +319,13 @@ public:
|
||||
|
||||
virtual longlong
|
||||
Item_func_between_val_int(Item_func_between *func) const= 0;
|
||||
|
||||
virtual in_vector *
|
||||
make_in_vector(THD *thd, const Item_func_in *func, uint nargs) const= 0;
|
||||
|
||||
virtual bool
|
||||
Item_func_in_fix_comparator_compatible_types(THD *thd, Item_func_in *)
|
||||
const= 0;
|
||||
};
|
||||
|
||||
|
||||
@ -414,6 +423,9 @@ public:
|
||||
}
|
||||
|
||||
longlong Item_func_between_val_int(Item_func_between *func) const;
|
||||
in_vector *make_in_vector(THD *thd, const Item_func_in *f, uint nargs) const;
|
||||
bool Item_func_in_fix_comparator_compatible_types(THD *thd,
|
||||
Item_func_in *) const;
|
||||
};
|
||||
|
||||
|
||||
@ -462,6 +474,10 @@ public:
|
||||
MYSQL_TIME *,
|
||||
ulonglong fuzzydate) const;
|
||||
longlong Item_func_between_val_int(Item_func_between *func) const;
|
||||
in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const;
|
||||
bool Item_func_in_fix_comparator_compatible_types(THD *thd,
|
||||
Item_func_in *) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -495,6 +511,9 @@ public:
|
||||
MYSQL_TIME *,
|
||||
ulonglong fuzzydate) const;
|
||||
longlong Item_func_between_val_int(Item_func_between *func) const;
|
||||
in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const;
|
||||
bool Item_func_in_fix_comparator_compatible_types(THD *thd,
|
||||
Item_func_in *) const;
|
||||
};
|
||||
|
||||
|
||||
@ -528,6 +547,9 @@ public:
|
||||
MYSQL_TIME *,
|
||||
ulonglong fuzzydate) const;
|
||||
longlong Item_func_between_val_int(Item_func_between *func) const;
|
||||
in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const;
|
||||
bool Item_func_in_fix_comparator_compatible_types(THD *thd,
|
||||
Item_func_in *) const;
|
||||
};
|
||||
|
||||
|
||||
@ -559,6 +581,8 @@ public:
|
||||
MYSQL_TIME *,
|
||||
ulonglong fuzzydate) const;
|
||||
longlong Item_func_between_val_int(Item_func_between *func) const;
|
||||
bool Item_func_in_fix_comparator_compatible_types(THD *thd,
|
||||
Item_func_in *) const;
|
||||
};
|
||||
|
||||
|
||||
@ -594,6 +618,9 @@ public:
|
||||
MYSQL_TIME *,
|
||||
ulonglong fuzzydate) const;
|
||||
longlong Item_func_between_val_int(Item_func_between *func) const;
|
||||
in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const;
|
||||
bool Item_func_in_fix_comparator_compatible_types(THD *thd,
|
||||
Item_func_in *) const;
|
||||
};
|
||||
|
||||
|
||||
@ -714,6 +741,7 @@ public:
|
||||
virtual ~Type_handler_time_common() { }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
|
||||
int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
|
||||
in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const;
|
||||
};
|
||||
|
||||
|
||||
@ -741,6 +769,7 @@ class Type_handler_temporal_with_date: public Type_handler_temporal_result
|
||||
public:
|
||||
virtual ~Type_handler_temporal_with_date() {}
|
||||
int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
|
||||
in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const;
|
||||
};
|
||||
|
||||
|
||||
@ -1014,5 +1043,6 @@ extern Type_handler_null type_handler_null;
|
||||
extern Type_handler_varchar type_handler_varchar;
|
||||
extern Type_handler_longlong type_handler_longlong;
|
||||
extern Type_handler_newdecimal type_handler_newdecimal;
|
||||
extern Type_handler_datetime type_handler_datetime;
|
||||
|
||||
#endif /* SQL_TYPE_H_INCLUDED */
|
||||
|
Reference in New Issue
Block a user