private void joinAndCollect ( Object [ ] tags , ResetableIterator [ ] values , int pos , Object [ ] partialList , Object key , OutputCollector output , Reporter reporter ) throws IOException { if ( values . length == pos ) { // get a value from each source. Combine them TaggedMapOutput combined = combine ( tags , partialList ) ; collect ( key , combined , output , reporter ) ; return ; } ResetableIterator nextValues = values [ pos ] ; nextValues . reset ( ) ; while ( nextValues . hasNext ( ) ) { Object v = nextValues . next ( ) ; partialList [ pos ] = v ; joinAndCollect ( tags , values , pos + 1 , partialList , key , output , reporter ) ; } }
Perform the actual join recursively .