Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LIN-1022 : [add] add relationship attributes search in lineage list API #3377

Merged
merged 3 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class LineageListRequest {
private SearchParameters.FilterCriteria entityTraversalFilters;
private SearchParameters.FilterCriteria relationshipTraversalFilters;
private Set<String> attributes;
private Set<String> relationAttributes;
private Boolean excludeMeanings;
private Boolean excludeClassifications;

Expand All @@ -32,11 +33,12 @@ public enum LineageDirection {INPUT, OUTPUT}

public LineageListRequest() {
this.attributes = new HashSet<>();
this.relationAttributes = new HashSet<>();
}

public LineageListRequest(String guid, Integer size, Integer from, Integer depth, LineageDirection direction, SearchParameters.FilterCriteria entityFilters,
SearchParameters.FilterCriteria entityTraversalFilters, SearchParameters.FilterCriteria relationshipTraversalFilters,
Set<String> attributes, boolean excludeMeanings, boolean excludeClassifications) {
Set<String> attributes, boolean excludeMeanings, boolean excludeClassifications, Set<String> relationAttributes) {
this.guid = guid;
this.size = size;
this.from = from;
Expand All @@ -48,6 +50,7 @@ public LineageListRequest(String guid, Integer size, Integer from, Integer depth
this.attributes = attributes;
this.excludeMeanings = excludeMeanings;
this.excludeClassifications = excludeClassifications;
this.relationAttributes = relationAttributes;
}

public String getGuid() {
Expand Down Expand Up @@ -129,6 +132,14 @@ public void setAttributes(Set<String> attributes) {
this.attributes = attributes;
}

public Set<String> getRelationAttributes() {
return relationAttributes;
}

public void setRelationAttributes(Set<String> relationAttributes) {
this.relationAttributes = relationAttributes;
}

public Boolean isExcludeMeanings() {
return excludeMeanings;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public final class AtlasLineageListContext {
private Predicate vertexTraversalPredicate;
private Predicate edgeTraversalPredicate;
private Set<String> attributes;
private Set<String> relationAttributes;
private int currentFromCounter;
private int currentEntityCounter;
private boolean depthLimitReached;
Expand All @@ -35,6 +36,7 @@ public AtlasLineageListContext(LineageListRequest lineageListRequest, AtlasTypeR
this.edgeTraversalPredicate = constructInMemoryPredicate(typeRegistry, lineageListRequest.getRelationshipTraversalFilters());
this.attributes = lineageListRequest.getAttributes();
this.lineageType = lineageListRequest.getLineageType();
this.relationAttributes = lineageListRequest.getRelationAttributes();
}

public String getGuid() {
Expand Down Expand Up @@ -113,6 +115,14 @@ public void setAttributes(Set<String> attributes) {
this.attributes = attributes;
}

public Set<String> getRelationAttributes() {
return relationAttributes;
}

public void setRelationAttributes(Set<String> relationAttributes) {
this.relationAttributes = relationAttributes;
}

public int getCurrentFromCounter() {
return currentFromCounter;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ public AtlasLineageListInfo getLineageListInfoOnDemand(String guid, LineageListR
RequestContext.get().setLineageInputLabel(LINEAGE_MAP.get(lineageListRequest.getLineageType())[0]);
RequestContext.get().setLineageOutputLabel(LINEAGE_MAP.get(lineageListRequest.getLineageType())[1]);
AtlasLineageListInfo ret = new AtlasLineageListInfo(new ArrayList<>());
RequestContext.get().setRelationAttrsForSearch(lineageListRequest.getRelationAttributes());

traverseEdgesUsingBFS(guid, new AtlasLineageListContext(lineageListRequest, atlasTypeRegistry), ret);
ret.setSearchParameters(lineageListRequest);

Expand Down
Loading