-
Alexander Barkov authored
Summary: This patch enables possible index optimization when the WHERE clause has an IN condition of the form: signed_or_unsigned_column IN (signed_or_unsigned_constant, signed_or_unsigned_constant [,signed_or_unsigned_constant]*) when the IN list constants are of different signess, e.g.: WHERE signed_column IN (signed_constant, unsigned_constant ...) WHERE unsigned_column IN (signed_constant, unsigned_constant ...) Details: In a condition like: WHERE unsigned_predicant IN (1, LONGLONG_MAX + 1) comparison handlers for individual (predicant,value) pairs are calculated as follows: * unsigned_predicant and 1 produce &type_handler_newdecimal * unsigned_predicant and (LONGLONG_MAX + 1) produce &type_handler_slonglong The old code decided that it could not use bisection because the two pairs had different comparison handlers. As a result, bisection was not allowed, and, in case of an indexed integer column predicant the index on the column was not used. The new code catches special cases like: signed_predicant IN (signed_constant, unsigned_constant) unsigned_predicant IN (signed_constant, unsigned_constant) It enables bisection using in_longlong, which supports a mixture of predicant and values of different signess. In case when the predicant is an indexed column this change automatically enables index range optimization. Thanks to Vicențiu Ciorbaru for proposing the idea and for preparing MTR tests.
53499cd1