• Alexander Barkov's avatar
    MDEV-11503 Introduce Type_handler::make_in_vector() and... · 93bc7283
    Alexander Barkov authored
    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)
    93bc7283
sql_type.cc 48 KB