This is an automated email from the ASF dual-hosted git repository.

jshao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new e5cc419fa9 [#10629]Improvement(core): Add tagName field and getter to 
GetTagForMetadata (#10651)
e5cc419fa9 is described below

commit e5cc419fa915583cf335ed453ad71acf25a4b2bb
Author: tanya0793 <[email protected]>
AuthorDate: Tue Apr 7 22:41:46 2026 -0500

    [#10629]Improvement(core): Add tagName field and getter to 
GetTagForMetadata (#10651)
    
    ### What changes were proposed in this pull request?
    
    Added a private final String tagName field to
    GetTagForMetadataObjectFailureEvent.
    Assigned it from the constructor’s name argument, and exposed it with a
    getter .
    Additional check in the test included
    
    
    ### Why are the changes needed?
    Fix : https://github.com/apache/gravitino/issues/10629
    
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    
    ### How was this patch tested?
    In the testcase testGetTagForMetadataObjectFailureEvent in TestTagEvent,
    verified whether the tagName is preserved
---
 .../api/event/GetTagForMetadataObjectFailureEvent.java        | 11 +++++++++++
 .../org/apache/gravitino/listener/api/event/TestTagEvent.java |  1 +
 2 files changed, 12 insertions(+)

diff --git 
a/core/src/main/java/org/apache/gravitino/listener/api/event/GetTagForMetadataObjectFailureEvent.java
 
b/core/src/main/java/org/apache/gravitino/listener/api/event/GetTagForMetadataObjectFailureEvent.java
index 3489ac23bd..096785e5b6 100644
--- 
a/core/src/main/java/org/apache/gravitino/listener/api/event/GetTagForMetadataObjectFailureEvent.java
+++ 
b/core/src/main/java/org/apache/gravitino/listener/api/event/GetTagForMetadataObjectFailureEvent.java
@@ -30,6 +30,7 @@ import org.apache.gravitino.utils.MetadataObjectUtil;
 @DeveloperApi
 public class GetTagForMetadataObjectFailureEvent extends TagFailureEvent {
 
+  private final String tagName;
   /**
    * Constructs a new {@code GetTagForMetadataObjectFailureEvent} instance.
    *
@@ -47,6 +48,7 @@ public class GetTagForMetadataObjectFailureEvent extends 
TagFailureEvent {
       String name,
       Exception exception) {
     super(user, MetadataObjectUtil.toEntityIdent(metalake, metadataObject), 
exception);
+    this.tagName = name;
   }
 
   /**
@@ -58,4 +60,13 @@ public class GetTagForMetadataObjectFailureEvent extends 
TagFailureEvent {
   public OperationType operationType() {
     return OperationType.GET_TAG_FOR_METADATA_OBJECT;
   }
+
+  /**
+   * Returns the name of the tag whose lookup failed.
+   *
+   * @return the tag name.
+   */
+  public String tagName() {
+    return tagName;
+  }
 }
diff --git 
a/core/src/test/java/org/apache/gravitino/listener/api/event/TestTagEvent.java 
b/core/src/test/java/org/apache/gravitino/listener/api/event/TestTagEvent.java
index a53942751a..23eb638336 100644
--- 
a/core/src/test/java/org/apache/gravitino/listener/api/event/TestTagEvent.java
+++ 
b/core/src/test/java/org/apache/gravitino/listener/api/event/TestTagEvent.java
@@ -372,6 +372,7 @@ public class TestTagEvent {
         ((GetTagForMetadataObjectFailureEvent) event).exception().getClass());
     Assertions.assertEquals(OperationType.GET_TAG_FOR_METADATA_OBJECT, 
event.operationType());
     Assertions.assertEquals(OperationStatus.FAILURE, event.operationStatus());
+    Assertions.assertEquals(tag.name(), ((GetTagForMetadataObjectFailureEvent) 
event).tagName());
   }
 
   @Test

Reply via email to