chaitalicod commented on code in PR #511:
URL: https://github.com/apache/atlas/pull/511#discussion_r3860422709
##########
repository/src/main/java/org/apache/atlas/repository/impexp/StartEntityFetchByExportRequest.java:
##########
@@ -165,27 +176,49 @@ private List<String>
getEntitiesForMatchTypeUsingUniqueAttributes(AtlasObjectId
continue;
}
- List<String> guids = executeGremlinQuery(queryTemplate,
getBindingsForObjectId(typeName, attribute.getQualifiedName(), e.getValue()));
+ for (String typeToSearch : typeNamesToQuery) {
+ List<String> guids = executeGremlinQuery(queryTemplate,
getBindingsForObjectId(typeToSearch, attribute.getQualifiedName(),
e.getValue()));
- if (!CollectionUtils.isNotEmpty(guids)) {
- continue;
+ if (CollectionUtils.isNotEmpty(guids)) {
+ ret.addAll(guids);
+ }
}
-
- ret.addAll(guids);
}
return new ArrayList<>(ret);
}
- private List<String> getEntitiesForMatchTypeType(AtlasObjectId item,
String matchType) {
+ private List<String> getEntitiesForMatchTypeType(AtlasObjectId item,
String matchType) throws AtlasBaseException {
return executeGremlinQuery(getQueryTemplateForMatchType(matchType),
getBindingsForTypeName(item.getTypeName()));
}
- private HashMap<String, Object> getBindingsForTypeName(String typeName) {
- HashMap<String, Object> ret = new HashMap<>();
-
- ret.put(BINDING_PARAMETER_TYPENAME, new
HashSet<>(Arrays.asList(StringUtils.split(typeName, ","))));
+ private HashMap<String, Object> getBindingsForTypeName(String typeName)
throws AtlasBaseException {
+ HashMap<String, Object> ret = new HashMap<>();
+ Set<String> typeNamesToQuery = new HashSet<>();
+
+ if (StringUtils.isBlank(typeName)) {
+ typeNamesToQuery.addAll(typeRegistry.getAllEntityDefNames());
Review Comment:
Regression: no-typeName fallback ignores uniqueAttributes. The fallback
routes to getEntitiesForMatchTypeType, which runs EXPORT_TYPE_ALL_FOR_TYPE over
all entity types and drops the attribute filter. A request with only
uniqueAttributes now matches every entity in the system, and the caller picks
guids.get(0) (arbitrary).
Please check the impact on other usecases and regression if its fine
--
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]