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-974 : [master] add horizontal pagination node count #3334

Merged
merged 10 commits into from
Jul 24, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ public static class LineageInfoOnDemand {
boolean hasMoreOutputs;
int inputRelationsCount;
int outputRelationsCount;
int totalInputRelationsCount;
int totalOutputRelationsCount;
boolean isInputRelationsReachedLimit;
boolean isOutputRelationsReachedLimit;
@JsonProperty
Expand All @@ -188,13 +190,15 @@ public LineageInfoOnDemand(LineageOnDemandConstraints onDemandConstraints) {
this.hasMoreOutputs = false;
this.inputRelationsCount = 0;
this.outputRelationsCount = 0;
this.totalInputRelationsCount = 0;
this.totalOutputRelationsCount = 0;
this.isInputRelationsReachedLimit = false;
this.isOutputRelationsReachedLimit = false;
this.hasUpstream = false;
this.hasDownstream = false;
this.fromCounter = 0;
}

public boolean isInputRelationsReachedLimit() {
return isInputRelationsReachedLimit;
}
Expand Down Expand Up @@ -243,10 +247,18 @@ public void setHasDownstream(boolean hasDownstream) {
this.hasDownstream = hasDownstream;
}

public int getFromCounter() {
return fromCounter;
public int getTotalInputRelationsCount() {
return totalInputRelationsCount;
}

public void setTotalInputRelationsCount(int count) {this.totalInputRelationsCount = count;}

public int getTotalOutputRelationsCount() {
return totalOutputRelationsCount;
}

public void setTotalOutputRelationsCount(int count) {this.totalOutputRelationsCount = count;}

public void incrementFromCounter() {
fromCounter++;
}
Expand All @@ -255,6 +267,10 @@ public int getInputRelationsCount() {
return inputRelationsCount;
}

public int getFromCounter() {
return fromCounter;
}

public void incrementInputRelationsCount() {
this.inputRelationsCount++;
if (inputRelationsCount == onDemandConstraints.getInputRelationsLimit()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,24 +629,27 @@ else if (!isInput && ! isInVertexVisited)
}

private void setHasDownstream(AtlasLineageOnDemandContext atlasLineageOnDemandContext, AtlasVertex inVertex, LineageInfoOnDemand inLineageInfo) {
List<AtlasEdge> filteredEdges = getFilteredAtlasEdges(inVertex, PROCESS_INPUTS_EDGE, atlasLineageOnDemandContext);
if (!filteredEdges.isEmpty())
List<AtlasEdge> filteredEdges = getFilteredAtlasEdges(inVertex, IN, PROCESS_INPUTS_EDGE, atlasLineageOnDemandContext);
if (!filteredEdges.isEmpty()) {
inLineageInfo.setHasDownstream(true);
inLineageInfo.setTotalOutputRelationsCount(filteredEdges.size());
}
}

private void setHasUpstream(AtlasLineageOnDemandContext atlasLineageOnDemandContext, AtlasVertex outVertex, LineageInfoOnDemand outLineageInfo) {
List<AtlasEdge> filteredEdges = getFilteredAtlasEdges(outVertex, PROCESS_OUTPUTS_EDGE, atlasLineageOnDemandContext);
if (!filteredEdges.isEmpty())
List<AtlasEdge> filteredEdges = getFilteredAtlasEdges(outVertex, IN, PROCESS_OUTPUTS_EDGE, atlasLineageOnDemandContext);
if (!filteredEdges.isEmpty()) {
outLineageInfo.setHasUpstream(true);
outLineageInfo.setTotalInputRelationsCount(filteredEdges.size());
}
}

private List<AtlasEdge> getFilteredAtlasEdges(AtlasVertex outVertex, String processEdgeLabel, AtlasLineageOnDemandContext atlasLineageOnDemandContext) {
private List<AtlasEdge> getFilteredAtlasEdges(AtlasVertex outVertex, AtlasEdgeDirection direction, String processEdgeLabel, AtlasLineageOnDemandContext atlasLineageOnDemandContext) {
List<AtlasEdge> filteredEdges = new ArrayList<>();
Iterable<AtlasEdge> edges = outVertex.getEdges(IN, processEdgeLabel);
Iterable<AtlasEdge> edges = outVertex.getEdges(direction, processEdgeLabel);
for (AtlasEdge edge : edges) {
if (edgeMatchesEvaluation(edge, atlasLineageOnDemandContext)) {
filteredEdges.add(edge);
break;
}
}
return filteredEdges;
Expand Down
Loading