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

[#5070] improvement(core): Add check for the full name of the metadata object #5075

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jerqi
Copy link
Collaborator

@jerqi jerqi commented Oct 9, 2024

What changes were proposed in this pull request?

Add check for full name of the metadata object.

Why are the changes needed?

Fix: #5070

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Add UTs.

@jerqi jerqi changed the title [#5070] improvement(core): Add check for full name of the metadata object [#5070] improvement(core): Add check for the full name of the metadata object Oct 9, 2024
@jerqi jerqi requested review from jerryshao and yuqi1129 and removed request for jerryshao October 9, 2024 12:33
@jerqi jerqi marked this pull request as draft October 9, 2024 12:34
@jerqi jerqi marked this pull request as ready for review October 9, 2024 12:46
@jerqi jerqi self-assigned this Oct 10, 2024
@jerqi jerqi added the branch-0.6 Automatically cherry-pick commit to branch-0.6 label Oct 10, 2024
Comment on lines 427 to 429
void checkAndImportEntity(String metalake, MetadataObject metadataObject, GravitinoEnv env) {
MetadataObjectUtil.checkMetadataObject(metalake, metadataObject, env);
}
Copy link
Member

Choose a reason for hiding this comment

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

The checkAndImportEntity(...) function only have one line code.
We can directly call MetadataObjectUtil.checkMetadataObject(metalake, metadataObject, env).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is convenient to test. Because we can spy this method easily.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

Comment on lines 119 to 120
public static void checkMetadataObject(String metalake, MetadataObject object, GravitinoEnv env) {
NameIdentifier identifier = toEntityIdent(metalake, object);
Copy link
Member

Choose a reason for hiding this comment

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

I think we doesn't need GravitinoEnv env params in the checkMetadataObject(...) function.
We can directly call GravitinoEnv.getInstance() in the function body.

Copy link
Contributor

@jerryshao jerryshao Oct 10, 2024

Choose a reason for hiding this comment

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

Using env as a method parameter will make the mock test easy to achieve.

@jerqi jerqi requested a review from xunliu October 10, 2024 07:33
@jerqi jerqi closed this Oct 10, 2024
@jerqi jerqi reopened this Oct 10, 2024
}
break;

case COLUMN:
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we support checking columns or not? If the answer is 'No', you can remove case COLUMN: here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch-0.6 Automatically cherry-pick commit to branch-0.6
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Improvement] Add check for metadata object full name
4 participants