LuciferYang commented on code in PR #13446:
URL: https://github.com/apache/gravitino/pull/13446#discussion_r4092966215
##########
core/src/main/java/org/apache/gravitino/utils/MetadataObjectUtil.java:
##########
@@ -347,6 +348,15 @@ public static void checkMetadataObject(String metalake,
MetadataObject object) {
}
break;
+ case SEMANTIC_MODEL:
+ NameIdentifierUtil.checkSemanticModel(identifier);
+ try {
+ env.semanticModelDispatcher().loadSemanticModel(identifier);
+ } catch (NoSuchSemanticModelException e) {
+ throw exceptionToThrowSupplier.get();
+ }
+ break;
Review Comment:
There is no internal semantic-model dispatcher: `GravitinoEnv` exposes only
the public `semanticModelDispatcher()` (semantic model is the one entity type
without an internal variant), so it is the only option here. It follows the
same load-and-catch shape as the sibling cases. Adding an
`internalSemanticModelDispatcher` would let this skip hooks/events like the
others, but that belongs upstream of this fix.
##########
core/src/test/java/org/apache/gravitino/utils/TestMetadataObjectUtil.java:
##########
@@ -325,6 +328,9 @@ public void
testCheckMetadataObjectUsesInternalDispatchers() {
"metalake", MetadataObjects.of(null, "job",
MetadataObject.Type.JOB));
MetadataObjectUtil.checkMetadataObject(
"metalake", MetadataObjects.of(null, "template",
MetadataObject.Type.JOB_TEMPLATE));
+ MetadataObjectUtil.checkMetadataObject(
+ "metalake",
+ MetadataObjects.of("catalog.schema", "sm",
MetadataObject.Type.SEMANTIC_MODEL));
Review Comment:
The assertion verifies that `checkMetadataObject` consults the dispatcher
for a `SEMANTIC_MODEL` object (that `loadSemanticModel` is called), which is
the same existence-check pattern the rest of this test covers. SEMANTIC_MODEL
only has the public dispatcher (no internal one exists), so I kept it in this
test rather than split it out. I can rename the method to something
type-neutral if you'd prefer it not read as "internal only".
--
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]