You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ra...@apache.org on 2026/04/01 22:42:48 UTC

(atlas) 01/02: ATLAS-5257: searchRelatedEntities - Return empty result for missing relationship label instead of throwing exception (#575)

This is an automated email from the ASF dual-hosted git repository.

radhikakundam pushed a commit to branch atlas-2.5
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit 4e9a64277e511eed1de7db1c388e0d95ed3c75fd
Author: sheetalshah1007 <sh...@freestoneinfotech.com>
AuthorDate: Wed Apr 1 11:28:56 2026 +0530

    ATLAS-5257: searchRelatedEntities - Return empty result for missing relationship label instead of throwing exception (#575)
    
    (cherry picked from commit 7fe4910225226412e7f173db6d0aef8e3f116297)
---
 intg/src/main/java/org/apache/atlas/AtlasErrorCode.java            | 1 -
 .../java/org/apache/atlas/discovery/EntityDiscoveryService.java    | 7 ++++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
index aa79ad5d1..ca7220243 100644
--- a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
+++ b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
@@ -210,7 +210,6 @@ public enum AtlasErrorCode {
     NO_TYPE_NAME_ON_VERTEX(404, "ATLAS-404-00-015", "No typename found for given entity with guid: {0}"),
     NO_LINEAGE_CONSTRAINTS_FOR_GUID(404, "ATLAS-404-00-016", "No lineage constraints found for requested entity with guid : {0}"),
     IMPORT_NOT_FOUND(404, "ATLAS-404-00-017", "Import id {0} is not found"),
-    RELATIONSHIP_LABEL_NOT_FOUND(404, "ATLAS-404-00-018", "No edges found with relationship label ''{0}'' on entity {1} (guid: {2}). Either the relationship does not exist or the entity has no relationships of this type."),
 
     METHOD_NOT_ALLOWED(405, "ATLAS-405-00-001", "Error 405 - The request method {0} is inappropriate for the URL: {1}"),
 
diff --git a/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java b/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
index 3f845019d..ae0ccc1bc 100644
--- a/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
@@ -98,6 +98,7 @@ import java.nio.file.attribute.BasicFileAttributes;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -566,7 +567,11 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
             if (endEntityType == null) {
                 if (StringUtils.isEmpty(endEntityTypeName)) {
                     // No edges with this label exist on the entity
-                    throw new AtlasBaseException(AtlasErrorCode.RELATIONSHIP_LABEL_NOT_FOUND, relation, entityTypeName, guid);
+                    LOG.warn("No edges found for relation '{}' on entity '{}' (guid={}), returning empty result",
+                            relation, entityTypeName, guid);
+                    ret.setEntities(Collections.emptyList());
+                    ret.setApproximateCount(0L);
+                    return ret;
                 } else {
                     // Edges exist but entity type not in registry
                     throw new AtlasBaseException(AtlasErrorCode.INVALID_RELATIONSHIP_LABEL, relation, endEntityTypeName);