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


##########
core/src/main/java/org/apache/gravitino/catalog/ManagedSemanticModelOperations.java:
##########
@@ -131,15 +141,106 @@ public SemanticModel createSemanticModel(
   public SemanticModel alterSemanticModel(NameIdentifier ident, 
SemanticModelChange... changes)
       throws NoSuchSemanticModelException, SemanticModelAlreadyExistsException,
           IllegalSemanticModelException {
-    // TODO: Implement in the Semantic Model list/alter/drop capability.
-    throw new UnsupportedOperationException(
-        "alterSemanticModel: list/alter/drop capability is not implemented");
+    boolean validateForWrite = requiresWriteValidation(changes);
+
+    try {
+      return store.update(
+          ident,
+          SemanticModelEntity.class,
+          Entity.EntityType.SEMANTIC_MODEL,
+          oldEntity -> {
+            SemanticModelEntity candidate = applyChanges(oldEntity, changes);
+            if (validateForWrite) {
+              writeValidator.accept(
+                  NameIdentifier.of(candidate.namespace(), candidate.name()),
+                  candidate.definition());
+            }
+            return candidate;
+          });
+    } catch (NoSuchEntityException e) {
+      throw new NoSuchSemanticModelException(e, "Semantic Model %s does not 
exist", ident);
+    } catch (EntityAlreadyExistsException e) {
+      throw new SemanticModelAlreadyExistsException(
+          e, "A Semantic Model with the requested name already exists while 
altering %s", ident);
+    } catch (IOException e) {
+      throw new RuntimeException("Failed to alter Semantic Model " + ident, e);
+    }
   }
 
   @Override
   public boolean dropSemanticModel(NameIdentifier ident) {
-    // TODO: Implement in the Semantic Model list/alter/drop capability.
-    throw new UnsupportedOperationException(
-        "dropSemanticModel: list/alter/drop capability is not implemented");
+    try {
+      return store.delete(ident, Entity.EntityType.SEMANTIC_MODEL);

Review Comment:
   This PR is limited to tag- and authorization-independent Core lifecycle 
operations. It does not introduce owner, tag, or securable-object relations, so 
their lifecycle cleanup is outside this PR’s scope.
   
   Ownership and privilege relation cleanup is tracked under #12594, and #12867 
explicitly leaves it as separate storage integration work. Semantic Model tag 
association is not currently supported. The REST and governance integration 
work must handle that cleanup before exposing the combined surface, but no code 
or PR-description change is needed here.



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