jerryshao commented on code in PR #4109:
URL: https://github.com/apache/gravitino/pull/4109#discussion_r1675368583
##########
core/src/main/java/com/datastrato/gravitino/utils/NameIdentifierUtil.java:
##########
@@ -193,4 +198,54 @@ public static void check(boolean expression, @FormatString
String message, Objec
throw new IllegalNamespaceException(message, args);
}
}
+
+ /**
+ * Convert the given {@link NameIdentifier} and {@link Entity.EntityType} to
{@link
+ * MetadataObject}.
+ *
+ * @param ident The identifier
+ * @param entityType The entity type
+ * @return The converted {@link MetadataObject}
+ */
+ public static MetadataObject toMetadataObject(
+ NameIdentifier ident, Entity.EntityType entityType) {
+ Preconditions.checkArgument(
+ ident != null && entityType != null, "The identifier and entity type
must not be null");
+
+ Joiner dot = Joiner.on(".");
+
+ switch (entityType) {
+ case METALAKE:
+ checkMetalake(ident);
+ return MetadataObjects.of(null, ident.name(),
MetadataObject.Type.METALAKE);
+
+ case CATALOG:
+ checkCatalog(ident);
+ return MetadataObjects.of(null, ident.name(),
MetadataObject.Type.CATALOG);
Review Comment:
It is the design of metadata object, we use three level names, so catalog is
a top-level name.
--
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]