An [inner join](https://en.wikipedia.org/wiki/Join_(SQL)#Inner_join "wp: Join\_(SQL)#Inner_join") is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the [nested loop join](https://en.wikipedia.org/wiki/Nested loop join "wp: Nested loop join") algorithm, but a more scalable alternative is the [hash join](https://en.wikipedia.org/wiki/hash join "wp: hash join") algorithm.
<li><strong>Hash phase:</strong> Create a <ahref='https://en.wikipedia.org/wiki/Multimap'title='wp: Multimap'target='_blank'>multimap</a> from one of the two tables, mapping from each join column value to all the rows that contain it.</li>
<ul>
<li>The multimap must support hash-based lookup which scales better than a simple linear search, because that's the whole point of this algorithm.</li>
<li>Ideally we should create the multimap for the smaller table, thus minimizing its creation time and memory size.</li>
</ul>
<li><strong>Join phase:</strong> Scan the other table, and find matching rows by looking in the multimap created before.</li>
</ol>
In pseudo-code, the algorithm could be expressed as follows:
<pre><strong>let</strong><i>A</i> = the first input table (or ideally, the larger one)
<strong>let</strong><i>B</i> = the second input table (or ideally, the smaller one)
<strong>let</strong><i>j<sub>A</sub></i> = the join column ID of table <i>A</i>
<strong>let</strong><i>j<sub>B</sub></i> = the join column ID of table <i>B</i>
<strong>let</strong><i>M<sub>B</sub></i> = a multimap for mapping from single values to multiple rows of table <i>B</i> (starts out empty)
<strong>let</strong><i>C</i> = the output table (starts out empty)
<strong>for each</strong> row <i>b</i> in table <i>B</i>:
<strong>place</strong><i>b</i> in multimap <i>M<sub>B</sub></i> under key <i>b(j<sub>B</sub>)</i>
<strong>for each</strong> row <i>a</i> in table <i>A</i>:
<strong>for each</strong> row <i>b</i> in multimap <i>M<sub>B</sub></i> under key <i>a(j<sub>A</sub>)</i>:
<strong>let</strong><i>c</i> = the concatenation of row <i>a</i> and row <i>b</i>
<strong>place</strong> row <i>c</i> in table <i>C</i>
</pre>
# --instructions--
Implement the "hash join" algorithm as a function and demonstrate that it passes the test-case listed below. The function should accept two arrays of objects and return an array of combined objects.