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


##########
server/src/main/java/org/apache/gravitino/server/web/rest/MetadataObjectTagOperations.java:
##########
@@ -270,26 +299,65 @@ public Response associateTagsForObject(
           httpRequest,
           () -> {
             request.validate();
-            MetadataObject object =
-                MetadataObjects.parse(
-                    fullName, 
MetadataObject.Type.valueOf(type.toUpperCase(Locale.ROOT)));
+            MetadataObject object = parseMetadataObject(type, fullName);
             String[] tagNames =
                 tagDispatcher.associateTagsForMetadataObject(
                     metalake, object, request.getTagsToAdd(), 
request.getTagsToRemove());
             tagNames = tagNames == null ? new String[0] : tagNames;
-            LOG.info(
-                "Associated tags: {} for object type: {}, full name: {} under 
metalake: {}",
-                Arrays.toString(tagNames),
-                type,
-                fullName,
-                metalake);
+            logAssociatedTags(type, fullName, metalake, tagNames);
             return Utils.ok(new NameListResponse(tagNames));
           });
     } catch (Exception e) {
       return ExceptionHandlers.handleTagException(OperationType.ASSOCIATE, "", 
fullName, e);
     }
   }
 
+  private Response associateTagValuesForObjectInternal(
+      String metalake, String type, String fullName, TagValuesAssociateRequest 
request) {
+    LOG.info(
+        "Received associate tag values request for object type: {}, full name: 
{} under metalake: {}",
+        type,
+        fullName,
+        metalake);
+    try {
+      return Utils.doAs(
+          httpRequest,
+          () -> {
+            request.validate();
+            MetadataObject object = parseMetadataObject(type, fullName);
+            String[] tagNames =
+                tagDispatcher.associateTagValuesForMetadataObject(
+                    metalake, object, request.tagValuesToAdd(), 
request.tagValuesToRemove());

Review Comment:
   **[P2] Map the valueless/valued state conflict to 409**
   
   When this V2 request adds a valueless pair while non-null values for the 
same tag remain active, `TagMetaService` fails 
`Preconditions.checkArgument(activeValues.isEmpty())`. That becomes 
`IllegalArgumentException`, and `TagExceptionHandler` returns 400. This is a 
valid pair-shaped request that conflicts with current assignment state; the 
checked-in contract explicitly requires 409 for this case. Please raise or map 
a conflict exception and add a REST regression that starts with a valued 
assignment and then attempts a valueless add without removing the values.



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