mchades commented on code in PR #13791:
URL: https://github.com/apache/gravitino/pull/13791#discussion_r4250325905


##########
core/src/main/java/org/apache/gravitino/hook/SemanticModelHookDispatcher.java:
##########
@@ -86,19 +89,22 @@ public SemanticModel createSemanticModel(
           IllegalSemanticModelException {
     SemanticModel semanticModel =
         dispatcher.createSemanticModel(ident, comment, definition, properties);
+    setCreatorAsOwner(ident);
+    return semanticModel;
+  }
 
-    // Set the creator as the owner of the Semantic Model.
-    OwnerDispatcher ownerManager = ownerDispatcher.get();
-    if (ownerManager != null) {
-      ownerManager.setOwner(
-          ident.namespace().level(0),
-          NameIdentifierUtil.toMetadataObject(ident, 
Entity.EntityType.SEMANTIC_MODEL),
-          PrincipalUtils.getCurrentUserName(),
-          Owner.Type.USER);
-    }
+  @Override
+  public SemanticModel importSemanticModel(NameIdentifier ident, 
ImportedSemanticModel model) {
+    SemanticModel semanticModel = dispatcher.importSemanticModel(ident, model);
+    setCreatorAsOwner(ident);
     return semanticModel;

Review Comment:
   Duplicate of [this 
comment](https://github.com/apache/gravitino/pull/13791#discussion_r4247997809).
 Please see [my reply 
there](https://github.com/apache/gravitino/pull/13791#discussion_r4248497149).



##########
core/src/main/java/org/apache/gravitino/hook/SemanticModelHookDispatcher.java:
##########
@@ -123,4 +129,15 @@ public boolean dropSemanticModel(NameIdentifier ident) {
     }
     return dropped;
   }
+
+  private void setCreatorAsOwner(NameIdentifier ident) {
+    OwnerDispatcher ownerManager = ownerDispatcher.get();
+    if (ownerManager != null) {
+      ownerManager.setOwner(
+          ident.namespace().level(0),
+          NameIdentifierUtil.toMetadataObject(ident, 
Entity.EntityType.SEMANTIC_MODEL),
+          PrincipalUtils.getCurrentUserName(),
+          Owner.Type.USER);
+    }
+  }

Review Comment:
   Duplicate of [this 
comment](https://github.com/apache/gravitino/pull/13791#discussion_r4247997809).
 Please see [my reply 
there](https://github.com/apache/gravitino/pull/13791#discussion_r4248497149).



-- 
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]

Reply via email to