mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-11 08:23:40 +00:00
fix- Allow Lineage for stored Procedure (#15397)
* Allow Lineage for stored Procedure * Add Node in case of empty edges * Add for OpenSearchClient
This commit is contained in:
parent
249d6a03b6
commit
c2193a963f
@ -707,7 +707,6 @@ public class ElasticSearchClient implements SearchClient {
|
|||||||
throws IOException {
|
throws IOException {
|
||||||
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<>();
|
||||||
responseMap.put("entity", null);
|
|
||||||
es.org.elasticsearch.action.search.SearchRequest searchRequest =
|
es.org.elasticsearch.action.search.SearchRequest searchRequest =
|
||||||
new es.org.elasticsearch.action.search.SearchRequest(GLOBAL_SEARCH_ALIAS);
|
new es.org.elasticsearch.action.search.SearchRequest(GLOBAL_SEARCH_ALIAS);
|
||||||
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
||||||
@ -767,6 +766,22 @@ public class ElasticSearchClient implements SearchClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// TODO: Fix this , this is hack
|
||||||
|
if (edges.isEmpty()) {
|
||||||
|
es.org.elasticsearch.action.search.SearchRequest searchRequestForEntity =
|
||||||
|
new es.org.elasticsearch.action.search.SearchRequest(GLOBAL_SEARCH_ALIAS);
|
||||||
|
SearchSourceBuilder searchSourceBuilderForEntity = new SearchSourceBuilder();
|
||||||
|
searchSourceBuilderForEntity.query(
|
||||||
|
QueryBuilders.boolQuery().must(QueryBuilders.termQuery("fullyQualifiedName", fqn)));
|
||||||
|
searchRequestForEntity.source(searchSourceBuilderForEntity.size(1000));
|
||||||
|
SearchResponse searchResponseForEntity =
|
||||||
|
client.search(searchRequestForEntity, RequestOptions.DEFAULT);
|
||||||
|
for (var hit : searchResponseForEntity.getHits().getHits()) {
|
||||||
|
HashMap<String, Object> tempMap = new HashMap<>(JsonUtils.getMap(hit.getSourceAsMap()));
|
||||||
|
tempMap.keySet().removeAll(FIELDS_TO_REMOVE);
|
||||||
|
responseMap.put("entity", tempMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
responseMap.put("edges", edges);
|
responseMap.put("edges", edges);
|
||||||
responseMap.put("nodes", nodes);
|
responseMap.put("nodes", nodes);
|
||||||
return Response.status(OK).entity(responseMap).build();
|
return Response.status(OK).entity(responseMap).build();
|
||||||
|
|||||||
@ -770,6 +770,21 @@ public class OpenSearchClient implements SearchClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (edges.isEmpty()) {
|
||||||
|
os.org.opensearch.action.search.SearchRequest searchRequestForEntity =
|
||||||
|
new os.org.opensearch.action.search.SearchRequest(GLOBAL_SEARCH_ALIAS);
|
||||||
|
SearchSourceBuilder searchSourceBuilderForEntity = new SearchSourceBuilder();
|
||||||
|
searchSourceBuilderForEntity.query(
|
||||||
|
QueryBuilders.boolQuery().must(QueryBuilders.termQuery("fullyQualifiedName", fqn)));
|
||||||
|
searchRequestForEntity.source(searchSourceBuilderForEntity.size(1000));
|
||||||
|
SearchResponse searchResponseForEntity =
|
||||||
|
client.search(searchRequestForEntity, RequestOptions.DEFAULT);
|
||||||
|
for (var hit : searchResponseForEntity.getHits().getHits()) {
|
||||||
|
HashMap<String, Object> tempMap = new HashMap<>(JsonUtils.getMap(hit.getSourceAsMap()));
|
||||||
|
tempMap.keySet().removeAll(FIELDS_TO_REMOVE);
|
||||||
|
responseMap.put("entity", tempMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
responseMap.put("edges", edges);
|
responseMap.put("edges", edges);
|
||||||
responseMap.put("nodes", nodes);
|
responseMap.put("nodes", nodes);
|
||||||
return Response.status(OK).entity(responseMap).build();
|
return Response.status(OK).entity(responseMap).build();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user