-
Notifications
You must be signed in to change notification settings - Fork 9
MLH-1151 | optimise lineage calculation #5386
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -92,6 +92,8 @@ | |||||||||||||||||||||||
| import static org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2.getState; | ||||||||||||||||||||||||
| import static org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.__.id; | ||||||||||||||||||||||||
| import static org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.__.outV; | ||||||||||||||||||||||||
| import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.hasId; | ||||||||||||||||||||||||
| import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.not; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| public abstract class DeleteHandlerV1 { | ||||||||||||||||||||||||
| public static final Logger LOG = LoggerFactory.getLogger(DeleteHandlerV1.class); | ||||||||||||||||||||||||
|
|
@@ -1895,9 +1897,10 @@ private void updateAssetHasLineageStatusV2(AtlasVertex assetVertex, AtlasEdge cu | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Helper method to check for active lineage in a specific direction | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * @param assetVertex The vertex to check | ||||||||||||||||||||||||
| * @param currentEdge The current edge to exclude | ||||||||||||||||||||||||
| * @param direction The edge direction to explore | ||||||||||||||||||||||||
| * @param direction The edge direction to explore | ||||||||||||||||||||||||
| * @return True if active lineage exists in the specified direction | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| private boolean hasActiveLineageDirection(AtlasVertex assetVertex, AtlasEdge currentEdge, Direction direction) { | ||||||||||||||||||||||||
|
|
@@ -1915,24 +1918,19 @@ private boolean hasActiveLineageDirection(AtlasVertex assetVertex, AtlasEdge cur | |||||||||||||||||||||||
| .has(STATE_PROPERTY_KEY, ACTIVE_STATE_VALUE); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| // Complete the traversal with common operations | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| // Filter out current edge using Gremlin | ||||||||||||||||||||||||
| traversal = traversal.where(not(hasId(currentEdge.getIdForDisplay()))); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| for (String deletedEdgeId : RequestContext.get().getDeletedEdgesIdsForResetHasLineage()) { | ||||||||||||||||||||||||
| traversal = traversal.where(not(hasId(deletedEdgeId))); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| // Filter out current edge using Gremlin | |
| traversal = traversal.where(not(hasId(currentEdge.getIdForDisplay()))); | |
| for (String deletedEdgeId : RequestContext.get().getDeletedEdgesIdsForResetHasLineage()) { | |
| traversal = traversal.where(not(hasId(deletedEdgeId))); | |
| } | |
| // Filter out current edge and all deleted edges using a single Gremlin filter | |
| Set<String> excludedEdgeIds = new HashSet<>(); | |
| excludedEdgeIds.add(currentEdge.getIdForDisplay()); | |
| excludedEdgeIds.addAll(RequestContext.get().getDeletedEdgesIdsForResetHasLineage()); | |
| traversal = traversal.where(not(hasId(excludedEdgeIds.toArray(new String[0])))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Incorrect Lineage Calculation and Edge Traversal
The hasActiveLineageDirection method may calculate lineage incorrectly. It passes string representations of edge IDs to hasId(), which expects actual ID objects, causing filtering to fail. Additionally, the traversal uses .outV() universally, which is incorrect for outgoing edges as it returns the source vertex instead of the connected target.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont see this change behind FF @aarshi0301