Hi, Zardosht! On Jan 15, Zardosht Kasheff wrote:
Unfortunately, we need to do comparisons during phases when the Table object, and therefore the Field object, may not be around, such as during recovery. So for fixed length fields, we privately encode their length and metadata that explains how to compare them.
Yes, of course. I've seen this in other engines too. I mean, that to decide on how to compare, it's better to look at Field::key_type(), not at Field::type(). You can still privately encode this decision and store it in the table or elsewhere, field's key_type() will never change without an ALTER TABLE.
But really the API-correct way is to use Field::key_type() method and compare the values using the specified method. It's more future-proof than to hard-code comparison method mapping based on the field types.
Regards, Sergei