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

[#5901] feat(core): support tag event to Gravitino server #5998

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

Conversation

TungYuChiang
Copy link
Contributor

@TungYuChiang TungYuChiang commented Dec 26, 2024

What changes were proposed in this pull request?

  1. Create corresponding event like ListTagEvent
  2. Add corresponding event to TagEventDispatcher

Why are the changes needed?

Fix: #5901

Does this PR introduce any user-facing change?

no

How was this patch tested?

@@ -72,7 +85,10 @@ public Tag getTag(String metalake, String name) throws NoSuchTagException {
// TODO: getTagPreEvent
try {
// TODO: getTagEvent
Copy link
Collaborator

Choose a reason for hiding this comment

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

Redundant line?

@@ -121,7 +150,11 @@ public MetadataObject[] listMetadataObjectsForTag(String metalake, String name)
// TODO: listMetadataObjectsForTagPreEvent
try {
// TODO: listMetadataObjectsForTagEvent
Copy link
Collaborator

Choose a reason for hiding this comment

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

Redundant line?

@orenccl
Copy link
Collaborator

orenccl commented Dec 26, 2024

It would be better to turn this PR into a draft before updating the unit tests.

@xunliu xunliu marked this pull request as draft December 26, 2024 08:26
@FANNG1
Copy link
Contributor

FANNG1 commented Dec 26, 2024

will review the PR until #5944 is merged for some duplicated logic, please wait for a while.

@FANNG1
Copy link
Contributor

FANNG1 commented Jan 7, 2025

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

@FANNG1
Copy link
Contributor

FANNG1 commented Jan 7, 2025

cc @cool9850311

@TungYuChiang
Copy link
Contributor Author

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

sure, I will complete it within the next few days.

@TungYuChiang TungYuChiang force-pushed the feature/tagEvent branch 4 times, most recently from a680fe6 to 43c2d20 Compare January 11, 2025 08:26
// TODO: listTagsEvent
return dispatcher.listTags(metalake);
String[] tagNames = dispatcher.listTags(metalake);
eventBus.dispatchEvent(new ListTagEvent(PrincipalUtils.getCurrentUserName(), metalake));
Copy link
Contributor

Choose a reason for hiding this comment

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

could you rename ListTagsFailureEvent to ListTagFailureEvent to keep consistent with other list event?

Copy link
Contributor Author

@TungYuChiang TungYuChiang Jan 16, 2025

Choose a reason for hiding this comment

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

could you rename ListTagsFailureEvent to ListTagFailureEvent to keep consistent with other list event?

@FANNG1 , Would it be better to rename ListTagEvent to ListTagsEvent?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, ListTagsEvent is better

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

@FANNG1
Copy link
Contributor

FANNG1 commented Jan 13, 2025

please update the document too

@FANNG1
Copy link
Contributor

FANNG1 commented Jan 15, 2025

@TungYuChiang any progress? If this PR is merged these days, we could meet the 0.8 release.

@TungYuChiang
Copy link
Contributor Author

TungYuChiang commented Jan 15, 2025

@TungYuChiang any progress? If this PR is merged these days, we could meet the 0.8 release.

@FANNG1 , I’m sorry for the delay. I’ve been a bit busy these past few days, but I’ll finish it by tomorrow evening.
Thank you for your patience

@FANNG1
Copy link
Contributor

FANNG1 commented Jan 15, 2025

@TungYuChiang any progress? If this PR is merged these days, we could meet the 0.8 release.

@FANNG1 , I’m sorry for the delay. I’ve been a bit busy these past few days, but I’ll finish it by tomorrow evening. Thank you for your patience

no hurry, please take your time

@TungYuChiang
Copy link
Contributor Author

@FANNG1, I have fixed everything except renaming ListTagsInfoFailureEvent to ListTagInfoFailureEvent

-  CreateTag
-  AlterTagEvent
-  GetTag
-  DeleteTag
-  ListTag
-  ListTagInfo
- [x]  GetTagForMetadataObject
- [x]  ListMetadataObjectsForTag
- [x]  AssociateTagsForMetadataObject
- [x]  ListTagsForMetadataObject
- [x]  ListTagsInfoForMetadataObject
@TungYuChiang TungYuChiang force-pushed the feature/tagEvent branch 2 times, most recently from 26214d8 to 2c66d22 Compare January 19, 2025 07:46
@TungYuChiang
Copy link
Contributor Author

@FANNG1, I have fixed everything except renaming ListTagsInfoFailureEvent to ListTagInfoFailureEvent

* @param tag The {@link Tag} object representing the retrieved tag.
*/
public GetTagEvent(String user, String metalake, String tagName, Tag tag) {
super(user, NameIdentifier.of(metalake));
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, tagName) as resourceIdentifier.

// TODO: getTagEvent
return dispatcher.getTag(metalake, name);
Tag tag = dispatcher.getTag(metalake, name);
eventBus.dispatchEvent(
Copy link
Contributor

Choose a reason for hiding this comment

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

please create TagInfo and passing TagInfo to GetTagEvent

// TODO: listTagsEvent
return dispatcher.listTags(metalake);
String[] tagNames = dispatcher.listTags(metalake);
eventBus.dispatchEvent(new ListTagsEvent(PrincipalUtils.getCurrentUserName(), metalake));
Copy link
Contributor

Choose a reason for hiding this comment

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

please passing tagNames to ListTagsEvent

// TODO: getTagForMetadataObjectEvent
return dispatcher.getTagForMetadataObject(metalake, metadataObject, name);
Tag tag = dispatcher.getTagForMetadataObject(metalake, metadataObject, name);
eventBus.dispatchEvent(
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 TagInfo

public AlterTagEvent(
String user, String metalake, TagChange[] tagChanges, TagInfo updatedTagInfo) {
super(user, NameIdentifier.of(metalake));
this.tagChanges = tagChanges;
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 clone

  this.tagChanges = tagChanges.clone();

*/
public AlterTagEvent(
String user, String metalake, TagChange[] tagChanges, TagInfo updatedTagInfo) {
super(user, NameIdentifier.of(metalake));
Copy link
Contributor

Choose a reason for hiding this comment

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

use NameIdentifierUtil.ofTag(metalake, tagName) as identifier

super(user, NameIdentifier.of(metalake));
this.metalake = metalake;
this.metadataObject = metadataObject;
this.tagsToAdd = tagsToAdd;
Copy link
Contributor

Choose a reason for hiding this comment

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

use clone for tagsToAdd tagsToRemove associatedTags

String[] tagsToAdd,
String[] tagsToRemove,
String[] associatedTags) {
super(user, NameIdentifier.of(metalake));
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 MetadataObjectUtil.toEntityIdent(metalake, metadataObject) as identifier

*
* @return The {@link MetadataObject} with which the tags were associated.
*/
public MetadataObject metadataObject() {
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove this, duplicated with identifier

*
* @return The metalake from which the tags were associated.
*/
public String metalake() {
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove this, duplicated with identifier

@FANNG1
Copy link
Contributor

FANNG1 commented Jan 20, 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.

@TungYuChiang , please refer to XXTagFailureEvent for the definition of the resource identifier, thx.

@TungYuChiang
Copy link
Contributor Author

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.

@TungYuChiang , please refer to XXTagFailureEvent for the definition of the resource identifier, thx.

I will fix it in the next few days.

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 event to Gravitino server
3 participants