pinal-shah commented on code in PR #510:
URL: https://github.com/apache/atlas/pull/510#discussion_r2762606480
##########
repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java:
##########
@@ -648,6 +648,229 @@ public AtlasSearchResult searchRelatedEntities(String
guid, String relation, boo
return ret;
}
+ /**
+ * Optimized version of {@link #searchRelatedEntities(String, String,
boolean, SearchParameters)}
+ * that uses graph-layer paging when sorting is not required, providing
better performance
+ * for large relationship sets by pushing pagination down to the database
level.
+ *
+ * When sorting is required, falls back to standard Gremlin traversal
approach.
+ *
+ * @param guid unique ID of the entity
+ * @param relation relation name
+ * @param getApproximateCount whether to calculate approximate count
+ * @param searchParameters search parameters including sorting,
pagination, filters
+ * @param disableDefaultSorting when false (default), applies default
"name" sorting if sortBy is not specified;
+ * when true, no default sorting is applied
(enables graph-layer optimization)
+ */
+ @GraphTransaction
+ @Override
+ public AtlasSearchResult searchRelatedEntitiesV2(String guid, String
relation, boolean getApproximateCount, SearchParameters searchParameters,
boolean disableDefaultSorting) throws AtlasBaseException {
Review Comment:
Please incorporate changes in the existing method, to avoid code duplication
##########
webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java:
##########
@@ -566,6 +567,68 @@ public AtlasSearchResult
searchRelatedEntities(@QueryParam("guid") String guid,
}
}
+ /**
+ * Relationship search using V2 implementation with adaptive query
execution.
+ * {@link EntityDiscoveryService#searchRelatedEntitiesV2} selects between
+ * graph-layer paging (unsorted) and Gremlin traversal (sorted).
+ *
+ * @param guid Attribute name
+ * @param relation relationName
+ * @param attributes set of attributes in search result
+ * @param sortByAttribute sort the result using this attribute name
+ * @param sortOrder sorting order
+ * @param excludeDeletedEntities exclude deleted entities from results
+ * @param includeClassificationAttributes include classification
attributes in results
+ * @param getApproximateCount calculate approximate count
+ * @param disableDefaultSorting when false (default), applies default
"name" sorting if sortBy is not specified;
+ * when true, no default sorting is applied (enables graph-layer
optimization for better performance)
+ * @param limit limit the result set
+ * @param offset start offset of the result set
+ * @return Atlas search result
+ * @throws AtlasBaseException
+ */
+ @GET
+ @Path("relationship/v2")
Review Comment:
Please review if there is need to introduce new API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]