Skip to content

Commit d59832c

Browse files
authored
Merge pull request #2285 from atlanhq/feat/airflow-pipeline-fixes
fix: add base entity to guidEntityMap in lineage response
2 parents f56e533 + 0200269 commit d59832c

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

repository/src/main/java/org/apache/atlas/discovery/EntityLineageService.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -284,26 +284,23 @@ private AtlasLineageOnDemandInfo getLineageInfoOnDemand(String guid, AtlasLineag
284284
LineageOnDemandConstraints lineageConstraintsByGuid = getAndValidateLineageConstraintsByGuid(guid, atlasLineageOnDemandContext);
285285
AtlasLineageOnDemandInfo.LineageDirection direction = lineageConstraintsByGuid.getDirection();
286286
int depth = lineageConstraintsByGuid.getDepth();
287-
288287
AtlasLineageOnDemandInfo ret = initializeLineageOnDemandInfo(guid);
289288

290-
if (depth == 0) {
289+
if (depth == 0)
291290
depth = -1;
292-
}
293-
294-
if (!ret.getRelationsOnDemand().containsKey(guid)) {
291+
if (!ret.getRelationsOnDemand().containsKey(guid))
295292
ret.getRelationsOnDemand().put(guid, new LineageInfoOnDemand(lineageConstraintsByGuid));
296-
}
293+
297294
AtomicInteger inputEntitiesTraversed = new AtomicInteger(0);
298295
AtomicInteger outputEntitiesTraversed = new AtomicInteger(0);
299296
if (isDataSet) {
300297
AtlasVertex datasetVertex = AtlasGraphUtilsV2.findByGuid(this.graph, guid);
301-
if (direction == AtlasLineageOnDemandInfo.LineageDirection.INPUT || direction == AtlasLineageOnDemandInfo.LineageDirection.BOTH) {
298+
if (direction == AtlasLineageOnDemandInfo.LineageDirection.INPUT || direction == AtlasLineageOnDemandInfo.LineageDirection.BOTH)
302299
traverseEdgesOnDemand(datasetVertex, true, depth, new HashSet<>(), atlasLineageOnDemandContext, ret, guid, inputEntitiesTraversed);
303-
}
304-
if (direction == AtlasLineageOnDemandInfo.LineageDirection.OUTPUT || direction == AtlasLineageOnDemandInfo.LineageDirection.BOTH) {
300+
if (direction == AtlasLineageOnDemandInfo.LineageDirection.OUTPUT || direction == AtlasLineageOnDemandInfo.LineageDirection.BOTH)
305301
traverseEdgesOnDemand(datasetVertex, false, depth, new HashSet<>(), atlasLineageOnDemandContext, ret, guid, outputEntitiesTraversed);
306-
}
302+
AtlasEntityHeader baseEntityHeader = entityRetriever.toAtlasEntityHeader(datasetVertex, atlasLineageOnDemandContext.getAttributes());
303+
ret.getGuidEntityMap().put(guid, baseEntityHeader);
307304
} else {
308305
AtlasVertex processVertex = AtlasGraphUtilsV2.findByGuid(this.graph, guid);
309306
// make one hop to the next dataset vertices from process vertex and traverse with 'depth = depth - 1'
@@ -317,7 +314,6 @@ private AtlasLineageOnDemandInfo getLineageInfoOnDemand(String guid, AtlasLineag
317314
}
318315
}
319316
RequestContext.get().endMetricRecord(metricRecorder);
320-
321317
return ret;
322318
}
323319

0 commit comments

Comments
 (0)