0 - 3 of 3 tags for hash code

Problem statement
This is regarding on knowing the mathematics(logic) behind the hash function (hashrow and hashbucket) in Teradata side
Teradata SQL :

Hi Experts,
 
We are using HASH_MD5 function to calculate the checksum of columns in a table by concatinating them. hash_md5(col1||col2||col3||.......||col32). This function returns distinct value till certain column limit but any further column addition does not have any impact on checksum calculation. 

Hi, everyone!

As I have understood, generally, when performing a query the result goes to the Spool which can be
1. built locally on the AMP
2. duplicated to all AMPs
3. redistributed by hash code to all AMPs

Could you tell me, how the Optimizer decides by which field the result is redistributed to all AMPs?

Let's assume I have two tables T1 (fields p1, p2), T2 (fields q1,q2,q3) and a query like this:

SELECT T1.p2, T2.q2, T2.q3
FROM T1
INNER JOIN T2
ON (T1.p1=T2.q1)

The result contains fields p2,q2,q3. So, by which field it will be redistributed to all AMPs?