From 7bfe6c98722ab1a47f33a56a64ef7624728aad6b Mon Sep 17 00:00:00 2001 From: aarshi Date: Thu, 19 Dec 2024 18:50:31 +0530 Subject: [PATCH 1/4] add logs --- .../repository/store/graph/v2/EntityGraphRetriever.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java index 993f7534d5..c5e576a542 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java @@ -1078,14 +1078,20 @@ private void retrieveEdgeLabels(AtlasVertex entityVertex, AtlasEdgeDirection edg Set edgeLabels = new HashSet<>(); edgeLabelsDebug.stream().filter(Objects::nonNull).forEach(edgeLabel -> attributes.forEach(attribute->{ - if (edgeLabel.contains(attribute)){ + LOG.info("attribute requested: {}", attribute); + + if (edgeLabel.contains(attribute)){ + LOG.info("attribute matched by edge"); edgeLabels.add(attribute); return; } String edgeTypeName = edgesTypeName.get(edgeLabel); + + LOG.info("edgeTypeName for attribute: {} :{}", edgeTypeName, relationshipsLookup.containsKey(edgeTypeName)); if (MapUtils.isNotEmpty(relationshipsLookup) && relationshipsLookup.containsKey(edgeTypeName) && attribute.equals(relationshipsLookup.get(edgeTypeName))) { edgeLabels.add(attribute); + LOG.info("attribute matched by edgeTypeName"); } })); @@ -1941,6 +1947,7 @@ public Object getVertexAttributePreFetchCache(AtlasVertex vertex, AtlasAttribute if (vertex == null || attribute == null) { return null; } + LOG.info("finall call to attribute {} : {}", attribute.getName(), properties.get(attribute.getName())); TypeCategory typeCategory = attribute.getAttributeType().getTypeCategory(); TypeCategory elementTypeCategory = typeCategory == TypeCategory.ARRAY ? ((AtlasArrayType) attribute.getAttributeType()).getElementType().getTypeCategory() : null; From e9683e588bc4c6213d036fc4bc30499f3f699284 Mon Sep 17 00:00:00 2001 From: aarshi Date: Thu, 19 Dec 2024 19:13:48 +0530 Subject: [PATCH 2/4] add logs --- .../store/graph/v2/EntityGraphRetriever.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java index c5e576a542..2da180cf62 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java @@ -1060,6 +1060,8 @@ private Map fetchEdgeNames(AtlasEntityType entityType){ edgeNames.put(k1, k); }); }); + + LOG.warn("get all edges: {}", edgeNames); return edgeNames; } @@ -1078,20 +1080,20 @@ private void retrieveEdgeLabels(AtlasVertex entityVertex, AtlasEdgeDirection edg Set edgeLabels = new HashSet<>(); edgeLabelsDebug.stream().filter(Objects::nonNull).forEach(edgeLabel -> attributes.forEach(attribute->{ - LOG.info("attribute requested: {}", attribute); + LOG.warn("attribute requested: {}", attribute); if (edgeLabel.contains(attribute)){ - LOG.info("attribute matched by edge"); + LOG.warn("attribute matched by edge"); edgeLabels.add(attribute); return; } String edgeTypeName = edgesTypeName.get(edgeLabel); - LOG.info("edgeTypeName for attribute: {} :{}", edgeTypeName, relationshipsLookup.containsKey(edgeTypeName)); + LOG.warn("edgeTypeName for attribute: {} :{}", edgeTypeName, relationshipsLookup.containsKey(edgeTypeName)); if (MapUtils.isNotEmpty(relationshipsLookup) && relationshipsLookup.containsKey(edgeTypeName) && attribute.equals(relationshipsLookup.get(edgeTypeName))) { edgeLabels.add(attribute); - LOG.info("attribute matched by edgeTypeName"); + LOG.warn("attribute matched by edgeTypeName"); } })); @@ -1947,7 +1949,7 @@ public Object getVertexAttributePreFetchCache(AtlasVertex vertex, AtlasAttribute if (vertex == null || attribute == null) { return null; } - LOG.info("finall call to attribute {} : {}", attribute.getName(), properties.get(attribute.getName())); + LOG.warn("final call to attribute {} : {}", attribute.getName(), properties.get(attribute.getName())); TypeCategory typeCategory = attribute.getAttributeType().getTypeCategory(); TypeCategory elementTypeCategory = typeCategory == TypeCategory.ARRAY ? ((AtlasArrayType) attribute.getAttributeType()).getElementType().getTypeCategory() : null; From 017df90fd80cd5f5fe2e14ff956689ccf67ad784 Mon Sep 17 00:00:00 2001 From: aarshi Date: Thu, 19 Dec 2024 19:52:10 +0530 Subject: [PATCH 3/4] add attributes as set --- .../store/graph/v2/EntityGraphRetriever.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java index 2da180cf62..a4482c88cb 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java @@ -1014,7 +1014,7 @@ private Map preloadProperties(AtlasVertex entityVertex, AtlasEnt Iterator> traversal = ((AtlasJanusVertex)entityVertex).getWrappedElement().properties(); // retrieve all the valid relationships for this entityType - Map relationshipsLookup = fetchEdgeNames(entityType); + Map> relationshipsLookup = fetchEdgeNames(entityType); // Fetch edges in both directions retrieveEdgeLabels(entityVertex, AtlasEdgeDirection.BOTH, attributes, relationshipsLookup, propertiesMap); @@ -1052,12 +1052,13 @@ private Map preloadProperties(AtlasVertex entityVertex, AtlasEnt return propertiesMap; } - private Map fetchEdgeNames(AtlasEntityType entityType){ + private Map> fetchEdgeNames(AtlasEntityType entityType){ Map> relationships = entityType.getRelationshipAttributes(); - Map edgeNames = new HashMap<>(); + Map> edgeNames = new HashMap<>(); relationships.forEach((k,v) -> { v.forEach((k1,v1) -> { - edgeNames.put(k1, k); + edgeNames.putIfAbsent(k1, new HashSet<>()); + edgeNames.get(k1).add(k); }); }); @@ -1065,7 +1066,7 @@ private Map fetchEdgeNames(AtlasEntityType entityType){ return edgeNames; } - private void retrieveEdgeLabels(AtlasVertex entityVertex, AtlasEdgeDirection edgeDirection, Set attributes, Map relationshipsLookup,Map propertiesMap) throws AtlasBaseException { + private void retrieveEdgeLabels(AtlasVertex entityVertex, AtlasEdgeDirection edgeDirection, Set attributes, Map> relationshipsLookup,Map propertiesMap) throws AtlasBaseException { Iterator edges = GraphHelper.getOnlyActiveEdges(entityVertex, edgeDirection); List edgeLabelsDebug = new ArrayList<>(); @@ -1091,7 +1092,7 @@ private void retrieveEdgeLabels(AtlasVertex entityVertex, AtlasEdgeDirection edg String edgeTypeName = edgesTypeName.get(edgeLabel); LOG.warn("edgeTypeName for attribute: {} :{}", edgeTypeName, relationshipsLookup.containsKey(edgeTypeName)); - if (MapUtils.isNotEmpty(relationshipsLookup) && relationshipsLookup.containsKey(edgeTypeName) && attribute.equals(relationshipsLookup.get(edgeTypeName))) { + if (MapUtils.isNotEmpty(relationshipsLookup) && relationshipsLookup.containsKey(edgeTypeName) && relationshipsLookup.get(edgeTypeName).contains(attribute)) { edgeLabels.add(attribute); LOG.warn("attribute matched by edgeTypeName"); } From 112433ea79d1b33fa68791106dd925ca75e24303 Mon Sep 17 00:00:00 2001 From: aarshi Date: Thu, 19 Dec 2024 22:06:30 +0530 Subject: [PATCH 4/4] Remove logs --- .../repository/store/graph/v2/EntityGraphRetriever.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java index a4482c88cb..5003e8ba9f 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java @@ -1061,8 +1061,6 @@ private Map> fetchEdgeNames(AtlasEntityType entityType){ edgeNames.get(k1).add(k); }); }); - - LOG.warn("get all edges: {}", edgeNames); return edgeNames; } @@ -1081,20 +1079,16 @@ private void retrieveEdgeLabels(AtlasVertex entityVertex, AtlasEdgeDirection edg Set edgeLabels = new HashSet<>(); edgeLabelsDebug.stream().filter(Objects::nonNull).forEach(edgeLabel -> attributes.forEach(attribute->{ - LOG.warn("attribute requested: {}", attribute); if (edgeLabel.contains(attribute)){ - LOG.warn("attribute matched by edge"); edgeLabels.add(attribute); return; } String edgeTypeName = edgesTypeName.get(edgeLabel); - LOG.warn("edgeTypeName for attribute: {} :{}", edgeTypeName, relationshipsLookup.containsKey(edgeTypeName)); if (MapUtils.isNotEmpty(relationshipsLookup) && relationshipsLookup.containsKey(edgeTypeName) && relationshipsLookup.get(edgeTypeName).contains(attribute)) { edgeLabels.add(attribute); - LOG.warn("attribute matched by edgeTypeName"); } })); @@ -1950,7 +1944,6 @@ public Object getVertexAttributePreFetchCache(AtlasVertex vertex, AtlasAttribute if (vertex == null || attribute == null) { return null; } - LOG.warn("final call to attribute {} : {}", attribute.getName(), properties.get(attribute.getName())); TypeCategory typeCategory = attribute.getAttributeType().getTypeCategory(); TypeCategory elementTypeCategory = typeCategory == TypeCategory.ARRAY ? ((AtlasArrayType) attribute.getAttributeType()).getElementType().getTypeCategory() : null;