Commit edeeb023 authored by Igor Babaev's avatar Igor Babaev

Post-second-review fixes for the patch that added the code allowing to use

hash join over equi-join conditions without supporting indexes.


parent b251d8a4
This diff is collapsed.
This diff is collapsed.
...@@ -6445,6 +6445,7 @@ static bool create_hj_key_for_table(JOIN *join, JOIN_TAB *join_tab, ...@@ -6445,6 +6445,7 @@ static bool create_hj_key_for_table(JOIN *join, JOIN_TAB *join_tab,
} while (keyuse->table == table && keyuse->is_for_hash_join()); } while (keyuse->table == table && keyuse->is_for_hash_join());
if (!key_parts) if (!key_parts)
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
/* This memory is allocated only once for the joined table join_tab */
if (!(keyinfo= (KEY *) thd->alloc(sizeof(KEY))) || if (!(keyinfo= (KEY *) thd->alloc(sizeof(KEY))) ||
!(key_part_info = (KEY_PART_INFO *) thd->alloc(sizeof(KEY_PART_INFO)* !(key_part_info = (KEY_PART_INFO *) thd->alloc(sizeof(KEY_PART_INFO)*
key_parts))) key_parts)))
...@@ -6525,19 +6526,15 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, ...@@ -6525,19 +6526,15 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
{ {
if (!(~used_tables & keyuse->used_tables)) if (!(~used_tables & keyuse->used_tables))
{ {
if (is_hash_join_key_no(key) && if ((is_hash_join_key_no(key) &&
(keyparts == 0 || keyuse->keypart != (keyuse-1)->keypart)) (keyparts == 0 || keyuse->keypart != (keyuse-1)->keypart)) ||
{ (!is_hash_join_key_no(key) && keyparts == keyuse->keypart &&
length+= keyinfo->key_part[keyparts].store_length; !(found_part_ref_or_null & keyuse->optimize)))
keyparts++; {
} length+= keyinfo->key_part[keyparts].store_length;
else if (!is_hash_join_key_no(key) && keyparts == keyuse->keypart && keyparts++;
!(found_part_ref_or_null & keyuse->optimize)) found_part_ref_or_null|= keyuse->optimize & ~KEY_OPTIMIZE_EQ;
{ }
length+= keyinfo->key_part[keyuse->keypart].store_length;
found_part_ref_or_null|= keyuse->optimize;
keyparts++;
}
} }
keyuse++; keyuse++;
} while (keyuse->table == table && keyuse->key == key); } while (keyuse->table == table && keyuse->key == key);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment