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

[beta] LIN-974: add horizontal pagination node count #3276

Merged
merged 2 commits into from
Jun 24, 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 @@ -93,7 +93,7 @@ public enum AtlasConfiguration {
GRAPH_TRAVERSAL_PARALLELISM("atlas.graph.traverse.bucket.size",10),
LINEAGE_ON_DEMAND_ENABLED("atlas.lineage.on.demand.enabled", true),
LINEAGE_ON_DEMAND_DEFAULT_NODE_COUNT("atlas.lineage.on.demand.default.node.count", 3),
LINEAGE_MAX_NODE_COUNT("atlas.lineage.max.node.count", 1000),
LINEAGE_MAX_NODE_COUNT("atlas.lineage.max.node.count", 100),

SUPPORTED_RELATIONSHIP_EVENTS("atlas.notification.relationships.filter", "asset_readme,asset_links"),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ private boolean incrementAndCheckIfRelationsLimitReached(AtlasEdge atlasEdge, bo

setHorizontalPaginationFlags(isInput, atlasLineageOnDemandContext, ret, depth, entitiesTraversed, inVertex, inGuid, outVertex, outGuid, inLineageInfo, outLineageInfo);

boolean hasRelationsLimitReached = setVerticalPaginationFlags(depth, atlasLineageOnDemandContext, isInput, entitiesTraversed, inLineageInfo, outLineageInfo, inVertex, outVertex);
boolean hasRelationsLimitReached = setVerticalPaginationFlags(entitiesTraversed, inLineageInfo, outLineageInfo);
if (!hasRelationsLimitReached) {
ret.getRelationsOnDemand().put(inGuid, inLineageInfo);
ret.getRelationsOnDemand().put(outGuid, outLineageInfo);
Expand All @@ -602,29 +602,12 @@ private boolean incrementAndCheckIfRelationsLimitReached(AtlasEdge atlasEdge, bo
return hasRelationsLimitReached;
}

private boolean setVerticalPaginationFlags(int depth, AtlasLineageOnDemandContext atlasLineageOnDemandContext, boolean isInput, AtomicInteger entitiesTraversed, LineageInfoOnDemand inLineageInfo, LineageInfoOnDemand outLineageInfo, AtlasVertex inVertex, AtlasVertex outVertex) {
private boolean setVerticalPaginationFlags(AtomicInteger entitiesTraversed, LineageInfoOnDemand inLineageInfo, LineageInfoOnDemand outLineageInfo) {
boolean hasRelationsLimitReached = false;
if (inLineageInfo.isInputRelationsReachedLimit() || outLineageInfo.isOutputRelationsReachedLimit() || isEntityTraversalLimitReached(entitiesTraversed)) {
inLineageInfo.setHasMoreInputs(true);
outLineageInfo.setHasMoreOutputs(true);
hasRelationsLimitReached = true;

if (depth >= 0) {
boolean inIsProcess = Objects.equals(AtlasGraphUtilsV2.getTypeName(inVertex), PROCESS_SUPER_TYPE);
AtlasEdgeDirection inDirection = inIsProcess ? OUT: IN; // Process Node edges always points outwards
AtlasEdgeDirection outDirection = !inIsProcess ? OUT: IN; // Data Node edges always points inwards
String edgeLabel = isInput ? PROCESS_INPUTS_EDGE : PROCESS_OUTPUTS_EDGE;

if (outLineageInfo.getTotalOutputRelationsCount() == 0) {
List<AtlasEdge> outFilteredEdges = getFilteredAtlasEdges(outVertex, outDirection, edgeLabel, atlasLineageOnDemandContext, false);
outLineageInfo.setTotalOutputRelationsCount(outFilteredEdges.size());
}

if (inLineageInfo.getTotalInputRelationsCount() == 0) {
List<AtlasEdge> inFilteredEdges = getFilteredAtlasEdges(inVertex, inDirection, edgeLabel, atlasLineageOnDemandContext, false);
inLineageInfo.setTotalInputRelationsCount(inFilteredEdges.size());
}
}
}

if (!hasRelationsLimitReached) {
Expand All @@ -646,15 +629,19 @@ else if (!isInput && ! isInVertexVisited)
}

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

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

private List<AtlasEdge> getFilteredAtlasEdges(AtlasVertex outVertex, AtlasEdgeDirection direction, String processEdgeLabel, AtlasLineageOnDemandContext atlasLineageOnDemandContext, boolean hasAnyCheck) {
Expand Down
Loading