A followup for
Arg_comparator and other items were storing THD internally at fix_fields time and using it so that get_datetime_value could create an Item_cache_temporal at the first evaluation.
A correct fix for this bug is to move caching of temporal values from get_datetime_value to Arg_comparator::cache_converted_constant, where caches for non-temporal values are created at fix_fields time. This simplifies and unifies the code and further reduces the number of str_to_datetime calls.
work-in-progress patch is attached