I have two tables. one includes 1 million records, the other includes 20 million records.
table 1
value
(1, 1)
(2, 2)
(3, 3)
(4, 4)
(5, 4)
....
table 2
value
(55, 11)
(33, 22)
(44, 66)
(22, 11)
(11, 33)
....
I need to use the value in tables 1 to multiply by the value in table 2, get the rank of the result, and get top 5 in the rank. their result would be like:
value from table 1, top 5 for each value in table 1
(1, 1), 1*44 + 1*66 = 110
(1, 1), 1*55 + 1*11 = 66
(1, 1), 1*33 + 1*22 = 55
(1, 1), 1*11 + 1*33 = 44
(1, 1), 1*22 + 1* 11 = 33
.....
I tried to use cross join in hive. but I always get a failure due to the table is too large.