From a095346a9d32ca583d211d07075e805881fdb4e5 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Wed, 22 Dec 2010 00:37:35 -0800 Subject: Fixed LP bug #670380. Lifted the limitation that hash join could not be used over varchar fields with non-binary collation. --- sql/sql_join_cache.h | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'sql/sql_join_cache.h') diff --git a/sql/sql_join_cache.h b/sql/sql_join_cache.h index ea84a50c885..cd9acfe595c 100644 --- a/sql/sql_join_cache.h +++ b/sql/sql_join_cache.h @@ -738,6 +738,10 @@ public: class JOIN_CACHE_HASHED: public JOIN_CACHE { + typedef uint (JOIN_CACHE_HASHED::*Hash_func) (uchar *key, uint key_len); + typedef bool (JOIN_CACHE_HASHED::*Hash_cmp_func) (uchar *key1, uchar *key2, + uint key_len); + private: /* Size of the offset of a key entry in the hash table */ @@ -761,14 +765,40 @@ private: /* The offset of the data fields from the beginning of the record fields */ uint data_fields_offset; - - uint get_hash_idx(uchar* key, uint key_len); + + inline uint get_hash_idx_simple(uchar *key, uint key_len); + inline uint get_hash_idx_complex(uchar *key, uint key_len); + + inline bool equal_keys_simple(uchar *key1, uchar *key2, uint key_len); + inline bool equal_keys_complex(uchar *key1, uchar *key2, uint key_len); int init_hash_table(); void cleanup_hash_table(); protected: + /* + Index info on the TABLE_REF object used by the hash join + to look for matching records + */ + KEY *ref_key_info; + /* + Number of the key parts the TABLE_REF object used by the hash join + to look for matching records + */ + uint ref_used_key_parts; + + /* + The hash function used in the hash table, + usually set by the init() method + */ + Hash_func hash_func; + /* + The function to check whether two key entries in the hash table + are equal or not, usually set by the init() method + */ + Hash_cmp_func hash_cmp_func; + /* Length of a key value. It is assumed that all key values have the same length. -- cgit v1.2.1