• Alexander Barkov's avatar
    MDEV-13997 Change Item_bool_rowready_func2 to cache const items at fix time... · 84ed288f
    Alexander Barkov authored
    MDEV-13997 Change Item_bool_rowready_func2 to cache const items at fix time rather than evaluation time
    
    Side effect: the second debug Note in cache_temporal_4265.result disappeared.
    
    Before this change:
    - During JOIN::cache_const_exprs(),
      Item::get_cache() for Item_date_add_interval() was called.
      The data type for date_add('2001-01-01',interval 5 day) is VARCHAR,
      because the first argument is VARCHAR (not temporal).
      Item_get_cache() created Item_cache_str('2001-01-06').
    - During evaluate_join_record(), get_datetime_value() was called,
      which called Item::get_date() for Item_cache_str('2001-01-06').
      This gave the second Note. Then, get_datetime_value() created
      a new cache, now Item_cache_temporal for '2001-01-06', so not
      further str_to_datetime() happened.
    
    After this change:
    - During tem_bool_rowready_func2::fix_length_and_dec(),
      Arg_comparator::set_cmp_func_datetime() is called,
      which immediately creates an instance of Item_cache_date for
      the result of date_add('2001-01-01',interval 5 day).
      So later no str_to_datetime happens any more,
      neither during JOIN::cache_const_exprs(),
      nor during evaluate_join_record().
    84ed288f
cache_temporal_4265.result 717 Bytes