jerryshao commented on code in PR #4323:
URL: https://github.com/apache/gravitino/pull/4323#discussion_r1703810682
##########
core/src/main/java/org/apache/gravitino/storage/relational/JDBCBackend.java:
##########
@@ -360,6 +363,40 @@ public List<TagEntity> associateTagsWithMetadataObject(
.associateTagsWithMetadataObject(objectIdent, objectType, tagsToAdd,
tagsToRemove);
}
+ @Override
+ public <E extends Entity & HasIdentifier> List<E> listEntitiesByRelation(
+ SupportsRelationOperations.Type relType,
+ NameIdentifier nameIdentifier,
+ Entity.EntityType identType) {
+ switch (relType) {
+ case OWNER_REL:
+ List<E> list = Lists.newArrayList();
+ OwnerMetaService.getInstance()
+ .getOwner(nameIdentifier, identType)
+ .ifPresent(e -> list.add((E) e));
+ return list;
+ default:
+ throw new IllegalArgumentException(
+ String.format("Doesn't support the relation type %s", relType));
+ }
+ }
+
+ @Override
+ public void insertRelation(
+ SupportsRelationOperations.Type relType,
+ NameIdentifier srcIdentifier,
+ Entity.EntityType srcType,
+ NameIdentifier dstIdentifier,
+ Entity.EntityType dstType,
+ boolean override) {
+ if (relType == SupportsRelationOperations.Type.OWNER_REL) {
+ OwnerMetaService.getInstance().setOwner(srcIdentifier, srcType,
dstIdentifier, dstType);
+ } else {
+ throw new IllegalArgumentException(
+ String.format("Doesn't support the relation type %s", relType));
+ }
+ }
Review Comment:
Change this to switch case.
--
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]