Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#5900] feat(tag): support tag pre-event to Gravitino server #5980

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

amazingLychee
Copy link

@amazingLychee amazingLychee commented Dec 25, 2024

What changes were proposed in this pull request?

Implemented pre-event handling for all tag-related operations, including:

  • listTags
  • listTagsInfo
  • getTag
  • createTag
  • alterTag
  • deleteTag
  • listMetadataObjectsForTag
  • listTagsForMetadataObject
  • listTagsInfoForMetadataObject
  • associateTagsForMetadataObject
  • getTagForMetadataObject

Why are the changes needed?

(Please clarify why the changes are needed. For instance,

  1. If you propose a new API, clarify the use case for a new API.
  2. If you fix a bug, describe the bug.)

Fix: #5900

Does this PR introduce any user-facing change?

No

How was this patch tested?

(Please test your changes, and provide instructions on how to test it:

  1. If you add a feature or fix a bug, add a test to cover your changes.
  2. If you fix a flaky test, repeat it for many times to prove it works.)

@xunliu xunliu requested a review from FANNG1 December 25, 2024 03:46
@FANNG1
Copy link
Contributor

FANNG1 commented Dec 25, 2024

there are some duplicate code with #5944, wait until #5944 is merged.

@FANNG1
Copy link
Contributor

FANNG1 commented Jan 7, 2025

@amazingLychee could you rebase your code since #5944 is merged

@FANNG1
Copy link
Contributor

FANNG1 commented Jan 7, 2025

cc @cool9850311

@amazingLychee
Copy link
Author

@FANNG1 Thanks for letting me know. I will rebase my code later.

@FANNG1
Copy link
Contributor

FANNG1 commented Jan 13, 2025

Event represents an specific operation to specific resource, the current implement pass metalake as resource name, this's not correct for some event, please refer to XXTagFailureEvent for the definition of the resource.

@schoolLychee
Copy link

@FANNG1 I commit the implement of the tag pre-event and I am working on the test right now. Thank you!

@FANNG1
Copy link
Contributor

FANNG1 commented Jan 20, 2025

@FANNG1 I commit the implement of the tag pre-event and I am working on the test right now. Thank you!

could you add test in TestTagEvent, you could refer to TestTableEvent

* @param changes The changes being applied to the tag.
*/
public AlterTagPreEvent(String user, String metalake, String tagName, TagChange[] changes) {
super(user, NameIdentifier.of(metalake, tagName));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use NameIdentifierUtil.ofTag(metalake, name)

public class DeleteTagPreEvent extends TagPreEvent {

public DeleteTagPreEvent(String user, String metalake, String tagName) {
super(user, NameIdentifier.of(metalake, tagName));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NameIdentifierUtil.ofTag(metalake, name)

@DeveloperApi
public class GetTagPreEvent extends TagPreEvent {
public GetTagPreEvent(String user, String metalake, String tagName) {
super(user, NameIdentifierUtil.ofTag(metalake, tagName));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NameIdentifierUtil.ofTag(metalake, name)

* @param tagName The name of the tag.
*/
public ListMetadataObjectsForTagPreEvent(String user, String metalake, String tagName) {
super(user, NameIdentifierUtil.ofTag(metalake, tagName));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NameIdentifierUtil.ofTag(metalake, name)

@@ -98,6 +98,5 @@ public enum OperationType {
VIEW_EXISTS,
RENAME_VIEW,
LIST_VIEW,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about keeping this empty line?

import org.apache.gravitino.utils.NameIdentifierUtil;

@DeveloperApi
public class GetTagPreEvent extends TagPreEvent {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add javadoc

import org.apache.gravitino.annotation.DeveloperApi;

@DeveloperApi
public class ListTagsInfoPreEvent extends TagPreEvent {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add javadoc

import org.apache.gravitino.annotation.DeveloperApi;

@DeveloperApi
public class ListTagsPreEvent extends TagPreEvent {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add javadoc

import org.apache.gravitino.annotation.DeveloperApi;

@DeveloperApi
public class CreateTagPreEvent extends TagPreEvent {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add javadoc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Subtask] Support tag pre event to Gravitino server
3 participants