mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-05 07:38:26 +00:00
Bug fix for location findEntityReferenceById. getName was not returning the FQN.
This commit is contained in:
parent
345ad9d413
commit
5403b5522f
@ -102,7 +102,7 @@ public class TableRepository extends EntityRepository<Table> {
|
|||||||
table.setSampleData(fields.contains("sampleData") ? getSampleData(table) : null);
|
table.setSampleData(fields.contains("sampleData") ? getSampleData(table) : null);
|
||||||
table.setViewDefinition(fields.contains("viewDefinition") ? table.getViewDefinition() : null);
|
table.setViewDefinition(fields.contains("viewDefinition") ? table.getViewDefinition() : null);
|
||||||
table.setTableProfile(fields.contains("tableProfile") ? getTableProfile(table) : null);
|
table.setTableProfile(fields.contains("tableProfile") ? getTableProfile(table) : null);
|
||||||
table.setLocation(fields.contains("location") ? getLocation(table): null);
|
table.setLocation(fields.contains("location") ? getLocation(table.getId()): null);
|
||||||
table.setTableQueries(fields.contains("tableQueries") ? getQueries(table): null);
|
table.setTableQueries(fields.contains("tableQueries") ? getQueries(table): null);
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
@ -374,13 +374,11 @@ public class TableRepository extends EntityRepository<Table> {
|
|||||||
return dao.databaseDAO().findEntityReferenceById(UUID.fromString(result.get(0)));
|
return dao.databaseDAO().findEntityReferenceById(UUID.fromString(result.get(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private EntityReference getLocation(Table table) throws IOException {
|
private EntityReference getLocation(UUID tableId) throws IOException {
|
||||||
// Find database for the table
|
// Find the location of the table
|
||||||
String id = table.getId().toString();
|
List<String> result = dao.relationshipDAO().findTo(tableId.toString(), Relationship.HAS.ordinal(), Entity.LOCATION);
|
||||||
List<String> result = dao.relationshipDAO().findTo(id, Relationship.HAS.ordinal(), Entity.LOCATION);
|
|
||||||
if (result.size() == 1) {
|
if (result.size() == 1) {
|
||||||
Location location = dao.locationDAO().findEntityById(UUID.fromString(result.get(0)));
|
return dao.locationDAO().findEntityReferenceById(UUID.fromString(result.get(0)));
|
||||||
return new EntityReference().withName(location.getName()).withId(location.getId()).withType("location");
|
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -222,14 +222,11 @@ public final class TestUtils {
|
|||||||
assertNotNull(ref.getName());
|
assertNotNull(ref.getName());
|
||||||
assertNotNull(ref.getType());
|
assertNotNull(ref.getType());
|
||||||
// Ensure data entities use fully qualified name
|
// Ensure data entities use fully qualified name
|
||||||
if (List.of("table", "database", "metrics", "dashboard", "pipeline", "report", "topic", "chart")
|
if (List.of("table", "database", "metrics", "dashboard", "pipeline", "report", "topic", "chart", "location")
|
||||||
.contains(ref.getType())) {
|
.contains(ref.getType())) {
|
||||||
// FullyQualifiedName has "." as separator
|
// FullyQualifiedName has "." as separator
|
||||||
assertTrue(ref.getName().contains("."), "entity name is not fully qualified - " + ref.getName());
|
assertTrue(ref.getName().contains("."), "entity name is not fully qualified - " + ref.getName());
|
||||||
}
|
}
|
||||||
if (List.of("location").contains(ref.getName())) {
|
|
||||||
ref.getName().contains(":/"); // FullyQualifiedName has ":/" as separator
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void validateEntityReference(List<EntityReference> list) {
|
public static void validateEntityReference(List<EntityReference> list) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user