mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-26 17:34:41 +00:00
parent
a43835df32
commit
adfbc21a00
@ -775,7 +775,6 @@ public class ElasticSearchClient implements SearchClient {
|
|||||||
boolean deleted,
|
boolean deleted,
|
||||||
String entityType)
|
String entityType)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Set<String> visitedFQN = new HashSet<>();
|
|
||||||
Map<String, Object> responseMap = new HashMap<>();
|
Map<String, Object> responseMap = new HashMap<>();
|
||||||
Set<Map<String, Object>> edges = new HashSet<>();
|
Set<Map<String, Object>> edges = new HashSet<>();
|
||||||
Set<Map<String, Object>> nodes = new HashSet<>();
|
Set<Map<String, Object>> nodes = new HashSet<>();
|
||||||
@ -800,7 +799,6 @@ public class ElasticSearchClient implements SearchClient {
|
|||||||
}
|
}
|
||||||
getLineage(
|
getLineage(
|
||||||
fqn,
|
fqn,
|
||||||
visitedFQN,
|
|
||||||
downstreamDepth,
|
downstreamDepth,
|
||||||
edges,
|
edges,
|
||||||
nodes,
|
nodes,
|
||||||
@ -808,14 +806,7 @@ public class ElasticSearchClient implements SearchClient {
|
|||||||
"lineage.fromEntity.fqnHash.keyword",
|
"lineage.fromEntity.fqnHash.keyword",
|
||||||
deleted);
|
deleted);
|
||||||
getLineage(
|
getLineage(
|
||||||
fqn,
|
fqn, upstreamDepth, edges, nodes, queryFilter, "lineage.toEntity.fqnHash.keyword", deleted);
|
||||||
visitedFQN,
|
|
||||||
upstreamDepth,
|
|
||||||
edges,
|
|
||||||
nodes,
|
|
||||||
queryFilter,
|
|
||||||
"lineage.toEntity.fqnHash.keyword",
|
|
||||||
deleted);
|
|
||||||
responseMap.put("edges", edges);
|
responseMap.put("edges", edges);
|
||||||
responseMap.put("nodes", nodes);
|
responseMap.put("nodes", nodes);
|
||||||
return responseMap;
|
return responseMap;
|
||||||
@ -1041,7 +1032,6 @@ public class ElasticSearchClient implements SearchClient {
|
|||||||
|
|
||||||
private void getLineage(
|
private void getLineage(
|
||||||
String fqn,
|
String fqn,
|
||||||
Set<String> visitedFQN,
|
|
||||||
int depth,
|
int depth,
|
||||||
Set<Map<String, Object>> edges,
|
Set<Map<String, Object>> edges,
|
||||||
Set<Map<String, Object>> nodes,
|
Set<Map<String, Object>> nodes,
|
||||||
@ -1049,10 +1039,9 @@ public class ElasticSearchClient implements SearchClient {
|
|||||||
String direction,
|
String direction,
|
||||||
boolean deleted)
|
boolean deleted)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (depth <= 0 || visitedFQN.contains(fqn)) {
|
if (depth <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
visitedFQN.add(fqn);
|
|
||||||
es.org.elasticsearch.action.search.SearchRequest searchRequest =
|
es.org.elasticsearch.action.search.SearchRequest searchRequest =
|
||||||
new es.org.elasticsearch.action.search.SearchRequest(
|
new es.org.elasticsearch.action.search.SearchRequest(
|
||||||
Entity.getSearchRepository().getIndexOrAliasName(GLOBAL_SEARCH_ALIAS));
|
Entity.getSearchRepository().getIndexOrAliasName(GLOBAL_SEARCH_ALIAS));
|
||||||
@ -1082,27 +1071,13 @@ public class ElasticSearchClient implements SearchClient {
|
|||||||
if (!edges.contains(lin) && fromEntity.get("fqn").equals(fqn)) {
|
if (!edges.contains(lin) && fromEntity.get("fqn").equals(fqn)) {
|
||||||
edges.add(lin);
|
edges.add(lin);
|
||||||
getLineage(
|
getLineage(
|
||||||
toEntity.get("fqn"),
|
toEntity.get("fqn"), depth - 1, edges, nodes, queryFilter, direction, deleted);
|
||||||
visitedFQN,
|
|
||||||
depth - 1,
|
|
||||||
edges,
|
|
||||||
nodes,
|
|
||||||
queryFilter,
|
|
||||||
direction,
|
|
||||||
deleted);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!edges.contains(lin) && toEntity.get("fqn").equals(fqn)) {
|
if (!edges.contains(lin) && toEntity.get("fqn").equals(fqn)) {
|
||||||
edges.add(lin);
|
edges.add(lin);
|
||||||
getLineage(
|
getLineage(
|
||||||
fromEntity.get("fqn"),
|
fromEntity.get("fqn"), depth - 1, edges, nodes, queryFilter, direction, deleted);
|
||||||
visitedFQN,
|
|
||||||
depth - 1,
|
|
||||||
edges,
|
|
||||||
nodes,
|
|
||||||
queryFilter,
|
|
||||||
direction,
|
|
||||||
deleted);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1254,7 +1229,6 @@ public class ElasticSearchClient implements SearchClient {
|
|||||||
boolean deleted,
|
boolean deleted,
|
||||||
Map<String, Object> responseMap)
|
Map<String, Object> responseMap)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Set<String> visitedFQN = new HashSet<>();
|
|
||||||
Set<Map<String, Object>> edges = new HashSet<>();
|
Set<Map<String, Object>> edges = new HashSet<>();
|
||||||
Set<Map<String, Object>> nodes = new HashSet<>();
|
Set<Map<String, Object>> nodes = new HashSet<>();
|
||||||
Object[] searchAfter = null;
|
Object[] searchAfter = null;
|
||||||
@ -1300,7 +1274,6 @@ public class ElasticSearchClient implements SearchClient {
|
|||||||
edges.add(lin);
|
edges.add(lin);
|
||||||
getLineage(
|
getLineage(
|
||||||
fromEntity.get("fqn"),
|
fromEntity.get("fqn"),
|
||||||
visitedFQN,
|
|
||||||
upstreamDepth,
|
upstreamDepth,
|
||||||
edges,
|
edges,
|
||||||
nodes,
|
nodes,
|
||||||
@ -1309,7 +1282,6 @@ public class ElasticSearchClient implements SearchClient {
|
|||||||
deleted);
|
deleted);
|
||||||
getLineage(
|
getLineage(
|
||||||
toEntity.get("fqn"),
|
toEntity.get("fqn"),
|
||||||
visitedFQN,
|
|
||||||
downstreamDepth,
|
downstreamDepth,
|
||||||
edges,
|
edges,
|
||||||
nodes,
|
nodes,
|
||||||
@ -1329,23 +1301,9 @@ public class ElasticSearchClient implements SearchClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
getLineage(
|
getLineage(
|
||||||
fqn,
|
fqn, downstreamDepth, edges, nodes, queryFilter, "lineage.fromEntity.fqn.keyword", deleted);
|
||||||
visitedFQN,
|
|
||||||
downstreamDepth,
|
|
||||||
edges,
|
|
||||||
nodes,
|
|
||||||
queryFilter,
|
|
||||||
"lineage.fromEntity.fqn.keyword",
|
|
||||||
deleted);
|
|
||||||
getLineage(
|
getLineage(
|
||||||
fqn,
|
fqn, upstreamDepth, edges, nodes, queryFilter, "lineage.toEntity.fqn.keyword", deleted);
|
||||||
visitedFQN,
|
|
||||||
upstreamDepth,
|
|
||||||
edges,
|
|
||||||
nodes,
|
|
||||||
queryFilter,
|
|
||||||
"lineage.toEntity.fqn.keyword",
|
|
||||||
deleted);
|
|
||||||
|
|
||||||
// TODO: Fix this , this is hack
|
// TODO: Fix this , this is hack
|
||||||
if (edges.isEmpty()) {
|
if (edges.isEmpty()) {
|
||||||
|
@ -777,7 +777,6 @@ public class OpenSearchClient implements SearchClient {
|
|||||||
boolean deleted,
|
boolean deleted,
|
||||||
String entityType)
|
String entityType)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Set<String> visitedFQN = new HashSet<>();
|
|
||||||
if (entityType.equalsIgnoreCase(Entity.PIPELINE)
|
if (entityType.equalsIgnoreCase(Entity.PIPELINE)
|
||||||
|| entityType.equalsIgnoreCase(Entity.STORED_PROCEDURE)) {
|
|| entityType.equalsIgnoreCase(Entity.STORED_PROCEDURE)) {
|
||||||
return searchPipelineLineage(fqn, upstreamDepth, downstreamDepth, queryFilter, deleted);
|
return searchPipelineLineage(fqn, upstreamDepth, downstreamDepth, queryFilter, deleted);
|
||||||
@ -802,7 +801,6 @@ public class OpenSearchClient implements SearchClient {
|
|||||||
}
|
}
|
||||||
getLineage(
|
getLineage(
|
||||||
fqn,
|
fqn,
|
||||||
visitedFQN,
|
|
||||||
downstreamDepth,
|
downstreamDepth,
|
||||||
edges,
|
edges,
|
||||||
nodes,
|
nodes,
|
||||||
@ -810,14 +808,7 @@ public class OpenSearchClient implements SearchClient {
|
|||||||
"lineage.fromEntity.fqnHash.keyword",
|
"lineage.fromEntity.fqnHash.keyword",
|
||||||
deleted);
|
deleted);
|
||||||
getLineage(
|
getLineage(
|
||||||
fqn,
|
fqn, upstreamDepth, edges, nodes, queryFilter, "lineage.toEntity.fqnHash.keyword", deleted);
|
||||||
visitedFQN,
|
|
||||||
upstreamDepth,
|
|
||||||
edges,
|
|
||||||
nodes,
|
|
||||||
queryFilter,
|
|
||||||
"lineage.toEntity.fqnHash.keyword",
|
|
||||||
deleted);
|
|
||||||
responseMap.put("edges", edges);
|
responseMap.put("edges", edges);
|
||||||
responseMap.put("nodes", nodes);
|
responseMap.put("nodes", nodes);
|
||||||
return responseMap;
|
return responseMap;
|
||||||
@ -1041,7 +1032,6 @@ public class OpenSearchClient implements SearchClient {
|
|||||||
|
|
||||||
private void getLineage(
|
private void getLineage(
|
||||||
String fqn,
|
String fqn,
|
||||||
Set<String> visitedFQN,
|
|
||||||
int depth,
|
int depth,
|
||||||
Set<Map<String, Object>> edges,
|
Set<Map<String, Object>> edges,
|
||||||
Set<Map<String, Object>> nodes,
|
Set<Map<String, Object>> nodes,
|
||||||
@ -1049,10 +1039,9 @@ public class OpenSearchClient implements SearchClient {
|
|||||||
String direction,
|
String direction,
|
||||||
boolean deleted)
|
boolean deleted)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (depth <= 0 || visitedFQN.contains(fqn)) {
|
if (depth <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
visitedFQN.add(fqn);
|
|
||||||
os.org.opensearch.action.search.SearchRequest searchRequest =
|
os.org.opensearch.action.search.SearchRequest searchRequest =
|
||||||
new os.org.opensearch.action.search.SearchRequest(
|
new os.org.opensearch.action.search.SearchRequest(
|
||||||
Entity.getSearchRepository().getIndexOrAliasName(GLOBAL_SEARCH_ALIAS));
|
Entity.getSearchRepository().getIndexOrAliasName(GLOBAL_SEARCH_ALIAS));
|
||||||
@ -1084,27 +1073,13 @@ public class OpenSearchClient implements SearchClient {
|
|||||||
if (!edges.contains(lin) && fromEntity.get("fqn").equals(fqn)) {
|
if (!edges.contains(lin) && fromEntity.get("fqn").equals(fqn)) {
|
||||||
edges.add(lin);
|
edges.add(lin);
|
||||||
getLineage(
|
getLineage(
|
||||||
toEntity.get("fqn"),
|
toEntity.get("fqn"), depth - 1, edges, nodes, queryFilter, direction, deleted);
|
||||||
visitedFQN,
|
|
||||||
depth - 1,
|
|
||||||
edges,
|
|
||||||
nodes,
|
|
||||||
queryFilter,
|
|
||||||
direction,
|
|
||||||
deleted);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!edges.contains(lin) && toEntity.get("fqn").equals(fqn)) {
|
if (!edges.contains(lin) && toEntity.get("fqn").equals(fqn)) {
|
||||||
edges.add(lin);
|
edges.add(lin);
|
||||||
getLineage(
|
getLineage(
|
||||||
fromEntity.get("fqn"),
|
fromEntity.get("fqn"), depth - 1, edges, nodes, queryFilter, direction, deleted);
|
||||||
visitedFQN,
|
|
||||||
depth - 1,
|
|
||||||
edges,
|
|
||||||
nodes,
|
|
||||||
queryFilter,
|
|
||||||
direction,
|
|
||||||
deleted);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1251,7 +1226,6 @@ public class OpenSearchClient implements SearchClient {
|
|||||||
private Map<String, Object> searchPipelineLineage(
|
private Map<String, Object> searchPipelineLineage(
|
||||||
String fqn, int upstreamDepth, int downstreamDepth, String queryFilter, boolean deleted)
|
String fqn, int upstreamDepth, int downstreamDepth, String queryFilter, boolean deleted)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Set<String> visitedFQN = new HashSet<>();
|
|
||||||
Map<String, Object> responseMap = new HashMap<>();
|
Map<String, Object> responseMap = new HashMap<>();
|
||||||
Set<Map<String, Object>> edges = new HashSet<>();
|
Set<Map<String, Object>> edges = new HashSet<>();
|
||||||
Set<Map<String, Object>> nodes = new HashSet<>();
|
Set<Map<String, Object>> nodes = new HashSet<>();
|
||||||
@ -1298,7 +1272,6 @@ public class OpenSearchClient implements SearchClient {
|
|||||||
edges.add(lin);
|
edges.add(lin);
|
||||||
getLineage(
|
getLineage(
|
||||||
fromEntity.get("fqn"),
|
fromEntity.get("fqn"),
|
||||||
visitedFQN,
|
|
||||||
upstreamDepth,
|
upstreamDepth,
|
||||||
edges,
|
edges,
|
||||||
nodes,
|
nodes,
|
||||||
@ -1307,7 +1280,6 @@ public class OpenSearchClient implements SearchClient {
|
|||||||
deleted);
|
deleted);
|
||||||
getLineage(
|
getLineage(
|
||||||
toEntity.get("fqn"),
|
toEntity.get("fqn"),
|
||||||
visitedFQN,
|
|
||||||
downstreamDepth,
|
downstreamDepth,
|
||||||
edges,
|
edges,
|
||||||
nodes,
|
nodes,
|
||||||
@ -1327,23 +1299,9 @@ public class OpenSearchClient implements SearchClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
getLineage(
|
getLineage(
|
||||||
fqn,
|
fqn, downstreamDepth, edges, nodes, queryFilter, "lineage.fromEntity.fqn.keyword", deleted);
|
||||||
visitedFQN,
|
|
||||||
downstreamDepth,
|
|
||||||
edges,
|
|
||||||
nodes,
|
|
||||||
queryFilter,
|
|
||||||
"lineage.fromEntity.fqn.keyword",
|
|
||||||
deleted);
|
|
||||||
getLineage(
|
getLineage(
|
||||||
fqn,
|
fqn, upstreamDepth, edges, nodes, queryFilter, "lineage.toEntity.fqn.keyword", deleted);
|
||||||
visitedFQN,
|
|
||||||
upstreamDepth,
|
|
||||||
edges,
|
|
||||||
nodes,
|
|
||||||
queryFilter,
|
|
||||||
"lineage.toEntity.fqn.keyword",
|
|
||||||
deleted);
|
|
||||||
|
|
||||||
if (edges.isEmpty()) {
|
if (edges.isEmpty()) {
|
||||||
os.org.opensearch.action.search.SearchRequest searchRequestForEntity =
|
os.org.opensearch.action.search.SearchRequest searchRequestForEntity =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user