I have learnt some of the hash-join algorithms, and I know there usually are hash tables whose keys are calculated by the hash function. I am wondering that can the hash function be omitted and just use the value instead?
For example, tables user_table
[{"name": "tom", "id": 1}, {"name": "jerry". "id": 2}]
join score_table
[{"score": 5, "id": 1}, {"score": 7, "id": 2}]
on id
can I just use the key id
as the hash table key? So I can save the calculation of hash function.
Or it is said that hash function has many kinds and
def hash(id):
return id
is one of them?
Is there any other needs that I should apply a hash function?
UPDATE
From the discussion with @OmG, I know at least in multiple key join, there must be a hash function to calculate the key.