Skip to content

Commit

Permalink
fix: ambiguous reference to overload methods (#395)
Browse files Browse the repository at this point in the history
* fix: ambiguous reference to overload methods

* revert old API code change
  • Loading branch information
ybz1013 authored Aug 8, 2024
1 parent e45b413 commit 87bb3d7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public <SRC_SNAPSHOT extends RecordTemplate, DEST_SNAPSHOT extends RecordTemplat
@Nonnull Class<RELATIONSHIP> relationshipType, @Nonnull LocalRelationshipFilter relationshipFilter, int offset, int count) {
validateEntityFilter(sourceEntityFilter, sourceEntityClass);
validateEntityFilter(destinationEntityFilter, destinationEntityClass);
validateRelationshipFilter(relationshipFilter);
validateEntityFilter(relationshipFilter, relationshipType);

String destTableName = null;
if (destinationEntityClass != null) {
Expand Down Expand Up @@ -175,7 +175,7 @@ public <SRC_SNAPSHOT extends RecordTemplate, DEST_SNAPSHOT extends RecordTemplat
}

/**
* Finds a list of relationships of a specific type based on the given filters if applicable.
* Finds a list of relationships of a specific type (Urn) based on the given filters if applicable.
*
* @param sourceEntityUrn urn of the source entity to query
* @param sourceEntityFilter the filter to apply to the source entity when querying (not applicable to non-MG entities)
Expand All @@ -188,7 +188,7 @@ public <SRC_SNAPSHOT extends RecordTemplate, DEST_SNAPSHOT extends RecordTemplat
* @return A list of relationship records.
*/
@Nonnull
public <RELATIONSHIP extends RecordTemplate> List<RELATIONSHIP> findRelationships(
public <RELATIONSHIP extends RecordTemplate> List<RELATIONSHIP> findRelationshipsV2(
@Nullable Urn sourceEntityUrn, @Nullable LocalRelationshipFilter sourceEntityFilter,
@Nullable Urn destinationEntityUrn, @Nullable LocalRelationshipFilter destinationEntityFilter,
@Nonnull Class<RELATIONSHIP> relationshipType, @Nonnull LocalRelationshipFilter relationshipFilter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public void testFindOneRelationshipWithEntityUrn() throws Exception {
new AspectField().setAspect(AspectFoo.class.getCanonicalName()).setPath("/value"));
LocalRelationshipFilter destFilter = new LocalRelationshipFilter().setCriteria(new LocalRelationshipCriterionArray(filterCriterion));

List<ReportsTo> reportsToAlice = _localRelationshipQueryDAO.findRelationships(
List<ReportsTo> reportsToAlice = _localRelationshipQueryDAO.findRelationshipsV2(
null, null, fooEntityUrn, destFilter,
ReportsTo.class, new LocalRelationshipFilter().setCriteria(new LocalRelationshipCriterionArray()).setDirection(RelationshipDirection.UNDIRECTED),
-1, -1);
Expand All @@ -327,7 +327,7 @@ ReportsTo.class, new LocalRelationshipFilter().setCriteria(new LocalRelationship
deletionSQL.setParameter("source", jack.toString());
deletionSQL.execute();

reportsToAlice = _localRelationshipQueryDAO.findRelationships(
reportsToAlice = _localRelationshipQueryDAO.findRelationshipsV2(
null, null, fooEntityUrn, destFilter,
ReportsTo.class, new LocalRelationshipFilter().setCriteria(new LocalRelationshipCriterionArray()).setDirection(RelationshipDirection.UNDIRECTED),
-1, -1);
Expand Down Expand Up @@ -379,7 +379,7 @@ public void testFindOneRelationshipWithFilterWithEntityUrn() throws Exception {
new UrnField());
LocalRelationshipFilter filterUrn = new LocalRelationshipFilter().setCriteria(new LocalRelationshipCriterionArray(filterUrnCriterion));

List<ConsumeFrom> consumeFromSamza = _localRelationshipQueryDAO.findRelationships(barEntityUrn, filterUrn, fooEntityUrn, null,
List<ConsumeFrom> consumeFromSamza = _localRelationshipQueryDAO.findRelationshipsV2(barEntityUrn, filterUrn, fooEntityUrn, null,
ConsumeFrom.class,
new LocalRelationshipFilter().setCriteria(new LocalRelationshipCriterionArray()).setDirection(RelationshipDirection.UNDIRECTED),
-1, -1);
Expand All @@ -394,7 +394,7 @@ public void testFindOneRelationshipWithFilterWithEntityUrn() throws Exception {
LocalRelationshipFilter filterRelationship = new LocalRelationshipFilter().setCriteria(
new LocalRelationshipCriterionArray(filterRelationshipCriterion)).setDirection(RelationshipDirection.UNDIRECTED);

List<ConsumeFrom> consumeFromSamzaInNearline = _localRelationshipQueryDAO.findRelationships(barEntityUrn, filterUrn, fooEntityUrn, null,
List<ConsumeFrom> consumeFromSamzaInNearline = _localRelationshipQueryDAO.findRelationshipsV2(barEntityUrn, filterUrn, fooEntityUrn, null,
ConsumeFrom.class,
filterRelationship,
-1, -1);
Expand Down Expand Up @@ -454,7 +454,7 @@ public void testFindOneRelationshipForCrewUsage() throws Exception {
LocalRelationshipFilter filterUrn = new LocalRelationshipFilter().setCriteria(new LocalRelationshipCriterionArray(filterUrnCriterion));

// test owned by of crew1 can be found
List<OwnedBy> ownedByCrew1 = _localRelationshipQueryDAO.findRelationships(null, null, crewEntityUrn, filterUrn,
List<OwnedBy> ownedByCrew1 = _localRelationshipQueryDAO.findRelationshipsV2(null, null, crewEntityUrn, filterUrn,
OwnedBy.class, new LocalRelationshipFilter().setCriteria(new LocalRelationshipCriterionArray()).setDirection(RelationshipDirection.UNDIRECTED),
-1, -1);

Expand All @@ -468,7 +468,7 @@ OwnedBy.class, new LocalRelationshipFilter().setCriteria(new LocalRelationshipCr
LocalRelationshipFilter filterUrn2 = new LocalRelationshipFilter().setCriteria(new LocalRelationshipCriterionArray(filterUrnCriterion2));

// test owned by of crew2 can be found
List<OwnedBy> ownedByCrew2 = _localRelationshipQueryDAO.findRelationships(null, null, crewEntityUrn, filterUrn2,
List<OwnedBy> ownedByCrew2 = _localRelationshipQueryDAO.findRelationshipsV2(null, null, crewEntityUrn, filterUrn2,
OwnedBy.class, new LocalRelationshipFilter().setCriteria(new LocalRelationshipCriterionArray()).setDirection(RelationshipDirection.UNDIRECTED),
-1, -1);

Expand Down Expand Up @@ -516,7 +516,7 @@ public void testFindOneRelationshipWithFilterOnSourceEntityForCrewUsage() throws
LocalRelationshipFilter filterUrn1 = new LocalRelationshipFilter().setCriteria(new LocalRelationshipCriterionArray(filterUrnCriterion1));

// test owned by of crew can be filtered by source entity, e.g. only include kafka
List<OwnedBy> ownedByCrew1 = _localRelationshipQueryDAO.findRelationships(fooEntityUrn, filterUrn1, crewEntityUrn, filterUrn,
List<OwnedBy> ownedByCrew1 = _localRelationshipQueryDAO.findRelationshipsV2(fooEntityUrn, filterUrn1, crewEntityUrn, filterUrn,
OwnedBy.class, new LocalRelationshipFilter().setCriteria(new LocalRelationshipCriterionArray()).setDirection(RelationshipDirection.UNDIRECTED),
-1, -1);

Expand All @@ -540,7 +540,7 @@ public void testFindOneRelationshipWithNonUrnFilterOnSourceEntityForCrewUsage()

// non-mg entity cannot be filtered by non-urn filter. This will throw an exception.
assertThrows(IllegalArgumentException.class, () -> {
_localRelationshipQueryDAO.findRelationships(fooEntityUrn, filterUrn1, crewEntityUrn, filterUrn,
_localRelationshipQueryDAO.findRelationshipsV2(fooEntityUrn, filterUrn1, crewEntityUrn, filterUrn,
OwnedBy.class, new LocalRelationshipFilter().setCriteria(new LocalRelationshipCriterionArray()).setDirection(RelationshipDirection.UNDIRECTED),
-1, -1);
});
Expand Down Expand Up @@ -589,15 +589,15 @@ void testFindRelationshipsWithEntityUrnOffsetAndCount() throws Exception {
new AspectField().setAspect(AspectFoo.class.getCanonicalName()).setPath("/value"));
LocalRelationshipFilter filter = new LocalRelationshipFilter().setCriteria(new LocalRelationshipCriterionArray(filterCriterion));

List<ReportsTo> reportsToAlice = _localRelationshipQueryDAO.findRelationships(
List<ReportsTo> reportsToAlice = _localRelationshipQueryDAO.findRelationshipsV2(
null, null, fooEntityUrn, filter,
ReportsTo.class, new LocalRelationshipFilter().setCriteria(new LocalRelationshipCriterionArray()).setDirection(RelationshipDirection.UNDIRECTED),
-1, 3);

// Asserts only 3 reports-to relationships are returned
assertEquals(reportsToAlice.size(), 3);

reportsToAlice = _localRelationshipQueryDAO.findRelationships(
reportsToAlice = _localRelationshipQueryDAO.findRelationshipsV2(
null, null, fooEntityUrn, filter,
ReportsTo.class, new LocalRelationshipFilter().setCriteria(new LocalRelationshipCriterionArray()).setDirection(RelationshipDirection.UNDIRECTED),
2, 10);
Expand All @@ -608,7 +608,7 @@ ReportsTo.class, new LocalRelationshipFilter().setCriteria(new LocalRelationship
Set<FooUrn> expected = ImmutableSet.of(lisa, rose, jenny);
assertEquals(actual, expected);

reportsToAlice = _localRelationshipQueryDAO.findRelationships(
reportsToAlice = _localRelationshipQueryDAO.findRelationshipsV2(
null, null, fooEntityUrn, filter,
ReportsTo.class, new LocalRelationshipFilter().setCriteria(new LocalRelationshipCriterionArray()).setDirection(RelationshipDirection.UNDIRECTED),
2, -1);
Expand Down

0 comments on commit 87bb3d7

Please sign in to comment.