@Test public void join() throws Exception { doReturn(hashAffiliations).when(affiliations).mapToPair(Mockito.any()); doReturn(hashOrganizations).when(organizations).mapToPair(Mockito.any()); doReturn(joinedHashAffOrganizations).when(hashAffiliations).join(hashOrganizations); doReturn(joinedAffOrganizations).when(joinedHashAffOrganizations).values(); JavaRDD<Tuple2<AffMatchAffiliation, AffMatchOrganization>> retJoinedAffOrgs = affOrgJoiner.join(affiliations, organizations); assertTrue(joinedAffOrganizations == retJoinedAffOrgs); verify(affiliations).mapToPair(affHashFunction.capture()); assertAffHashFunction(affHashFunction.getValue()); verify(organizations).mapToPair(orgHashFunction.capture()); assertOrgHashFunction(orgHashFunction.getValue()); }
@Override public JavaRDD<Tuple2<AffMatchAffiliation, AffMatchOrganization>> join(JavaRDD<AffMatchAffiliation> affiliations, JavaRDD<AffMatchOrganization> organizations) { JavaPairRDD<String, AffMatchAffiliation> hashAffiliations = affiliations.mapToPair(aff -> new Tuple2<String, AffMatchAffiliation>(affiliationBucketHasher.hash(aff), aff)); JavaPairRDD<String, AffMatchOrganization> hashOrganizations = organizations.mapToPair(org -> new Tuple2<String, AffMatchOrganization>(organizationBucketHasher.hash(org), org)); JavaPairRDD<String, Tuple2<AffMatchAffiliation, AffMatchOrganization>> hashAffOrgs = hashAffiliations.join(hashOrganizations); return hashAffOrgs.values(); }
AffOrgHashBucketJoiner implements AffOrgJoiner { @Override public JavaRDD<Tuple2<AffMatchAffiliation, AffMatchOrganization>> join(JavaRDD<AffMatchAffiliation> affiliations, JavaRDD<AffMatchOrganization> organizations) { JavaPairRDD<String, AffMatchAffiliation> hashAffiliations = affiliations.mapToPair(aff -> new Tuple2<String, AffMatchAffiliation>(affiliationBucketHasher.hash(aff), aff)); JavaPairRDD<String, AffMatchOrganization> hashOrganizations = organizations.mapToPair(org -> new Tuple2<String, AffMatchOrganization>(organizationBucketHasher.hash(org), org)); JavaPairRDD<String, Tuple2<AffMatchAffiliation, AffMatchOrganization>> hashAffOrgs = hashAffiliations.join(hashOrganizations); return hashAffOrgs.values(); } }
AffOrgHashBucketJoiner implements AffOrgJoiner { @Override public JavaRDD<Tuple2<AffMatchAffiliation, AffMatchOrganization>> join(JavaRDD<AffMatchAffiliation> affiliations, JavaRDD<AffMatchOrganization> organizations) { JavaPairRDD<String, AffMatchAffiliation> hashAffiliations = affiliations.mapToPair(aff -> new Tuple2<String, AffMatchAffiliation>(affiliationBucketHasher.hash(aff), aff)); JavaPairRDD<String, AffMatchOrganization> hashOrganizations = organizations.mapToPair(org -> new Tuple2<String, AffMatchOrganization>(organizationBucketHasher.hash(org), org)); JavaPairRDD<String, Tuple2<AffMatchAffiliation, AffMatchOrganization>> hashAffOrgs = hashAffiliations.join(hashOrganizations); return hashAffOrgs.values(); }  }
AffOrgHashBucketJoiner implements AffOrgJoiner { @Override public JavaRDD<Tuple2<AffMatchAffiliation, AffMatchOrganization>> join(JavaRDD<AffMatchAffiliation> affiliations, JavaRDD<AffMatchOrganization> organizations) { JavaPairRDD<String, AffMatchAffiliation> hashAffiliations = affiliations.mapToPair(aff -> new Tuple2<String, AffMatchAffiliation>(affiliationBucketHasher.hash(aff), aff)); JavaPairRDD<String, AffMatchOrganization> hashOrganizations = organizations.mapToPair(org -> new Tuple2<String, AffMatchOrganization>(organizationBucketHasher.hash(org), org)); JavaPairRDD<String, Tuple2<AffMatchAffiliation, AffMatchOrganization>> hashAffOrgs = hashAffiliations.join(hashOrganizations); return hashAffOrgs.values(); }  @Override JavaRDD<Tuple2<AffMatchAffiliation, AffMatchOrganization>> join(JavaRDD<AffMatchAffiliation> affiliations, JavaRDD<AffMatchOrganization> organizations); void setAffiliationBucketHasher(BucketHasher<AffMatchAffiliation> affiliationBucketHasher); void setOrganizationBucketHasher(BucketHasher<AffMatchOrganization> organizationBucketHasher); }
AffOrgHashBucketJoiner implements AffOrgJoiner { @Override public JavaRDD<Tuple2<AffMatchAffiliation, AffMatchOrganization>> join(JavaRDD<AffMatchAffiliation> affiliations, JavaRDD<AffMatchOrganization> organizations) { JavaPairRDD<String, AffMatchAffiliation> hashAffiliations = affiliations.mapToPair(aff -> new Tuple2<String, AffMatchAffiliation>(affiliationBucketHasher.hash(aff), aff)); JavaPairRDD<String, AffMatchOrganization> hashOrganizations = organizations.mapToPair(org -> new Tuple2<String, AffMatchOrganization>(organizationBucketHasher.hash(org), org)); JavaPairRDD<String, Tuple2<AffMatchAffiliation, AffMatchOrganization>> hashAffOrgs = hashAffiliations.join(hashOrganizations); return hashAffOrgs.values(); }  @Override JavaRDD<Tuple2<AffMatchAffiliation, AffMatchOrganization>> join(JavaRDD<AffMatchAffiliation> affiliations, JavaRDD<AffMatchOrganization> organizations); void setAffiliationBucketHasher(BucketHasher<AffMatchAffiliation> affiliationBucketHasher); void setOrganizationBucketHasher(BucketHasher<AffMatchOrganization> organizationBucketHasher);  }