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

[#4873] feat(core): support list group #4879

Merged

Conversation

LiuQhahah
Copy link
Contributor

What changes were proposed in this pull request?

(Please outline the changes and how this PR fixes the issue.)

Why are the changes needed?

support list group

Fix: #4873

Does this PR introduce any user-facing change?

no

How was this patch tested?

UT

@jerqi
Copy link
Contributor

jerqi commented Sep 9, 2024

You can refer to the pull request https://github.com/apache/gravitino/pull/4055/files

@jerqi
Copy link
Contributor

jerqi commented Sep 24, 2024

@LiuQhahah #4055 pull request about listing users have been merged. Do you have time to rework this pull request?

@LiuQhahah
Copy link
Contributor Author

@LiuQhahah #4055 pull request about listing users have been merged. Do you have time to rework this pull request?

Hi @jerqi

what action need i to do ?
just close the PR?

@jerqi
Copy link
Contributor

jerqi commented Sep 24, 2024

@LiuQhahah #4055 pull request about listing users have been merged. Do you have time to rework this pull request?

Hi @jerqi

what action need i to do ? just close the PR?

#4055 is the pull request to support to list users.
You pull request is to list groups. Two operations are very similar.
You can refer to #4055 to modify your pull request.

There are several points to modify.

  1. You should add more uts and integration test (You can see AccessControlIT.java).
  2. You should support listGroupNames and listGroup operations.

@LiuQhahah
Copy link
Contributor Author

@LiuQhahah #4055 pull request about listing users have been merged. Do you have time to rework this pull request?

Hi @jerqi
what action need i to do ? just close the PR?

#4055 is the pull request to support to list users. You pull request is to list groups. Two operations are very similar. You can refer to #4055 to modify your pull request.

There are several points to modify.

  1. You should add more uts and integration test (You can see AccessControlIT.java).
  2. You should support listGroupNames and listGroup operations.

Understood, thanks for the advice!
I've been a little busy for a while, so I'll start working on this task today.

…operations

# Conflicts:
#	clients/client-java/src/test/java/org/apache/gravitino/client/TestUserGroup.java
#	core/src/main/java/org/apache/gravitino/authorization/UserGroupManager.java
#	core/src/main/java/org/apache/gravitino/storage/relational/JDBCBackend.java
@jerqi
Copy link
Contributor

jerqi commented Sep 26, 2024

@LiuQhahah Do you have time to continue this work? Because we want to release this feature in 0.6.1. The 0.6.1 will be released at the end of this month.

…operations

# Conflicts:
#	core/src/main/java/org/apache/gravitino/storage/relational/JDBCBackend.java
@LiuQhahah
Copy link
Contributor Author

@LiuQhahah Do you have time to continue this work? Because we want to release this feature in 0.6.1. The 0.6.1 will be released at the end of this month.

Hi @jerqi
I'll submit a version tonight.

@jerqi
Copy link
Contributor

jerqi commented Sep 26, 2024

@LiuQhahah Do you have time to continue this work? Because we want to release this feature in 0.6.1. The 0.6.1 will be released at the end of this month.

Hi @jerqi I'll submit a version tonight.

I have updated partial user list implement. You can see #4894

@@ -227,6 +227,15 @@ public Group getGroup(String group) throws NoSuchGroupException, NoSuchMetalakeE
return getMetalake().getGroup(group);
}


Copy link
Contributor

@jerqi jerqi Sep 26, 2024

Choose a reason for hiding this comment

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

Javadoc is necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll add to that, thanks.

@jerqi
Copy link
Contributor

jerqi commented Sep 26, 2024

@LiuQhahah Could you give the permission of your repo? I can help you finish this pull request. We are eager to finish the feature before 0.6.1.

@LiuQhahah
Copy link
Contributor Author

@LiuQhahah Could you give the permission of your repo? I can help you finish this pull request. We are eager to finish the feature before 0.6.1.

Okay, thanks.

image

@jerqi jerqi added the branch-0.6 Automatically cherry-pick commit to branch-0.6 label Sep 27, 2024
@yuqi1129 yuqi1129 changed the title #4873 support list group [#4873] feat(core): support list group Sep 27, 2024
NoSuchMetalakeException.class,
() -> {
gravitinoClient.listGroupNames();
});
Copy link
Contributor

Choose a reason for hiding this comment

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

() -> gravitinoClient.listGroupNames()

Copy link
Contributor

Choose a reason for hiding this comment

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

OK.

Comment on lines 222 to 226
String[] listGroupNames(String metalake) {
return Arrays.stream(listGroupInternal(metalake, false))
.map(Group::name)
.toArray(String[]::new);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please move this method above, after listGroups.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK.

+ GROUP_TABLE_NAME
+ " gt JOIN "
+ MetalakeMetaMapper.TABLE_NAME
+ " mt ON gt.metalake_id = mt.metalake_id WHERE mt.metalake_name = #{metalakeName}"
Copy link
Contributor

Choose a reason for hiding this comment

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

excessive space before WHERE

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, removed.

.forEach(
group -> {
Preconditions.checkArgument(
StringUtils.isNotBlank(group.name()), "group 'name' must not be null and empty");
Copy link
Contributor

Choose a reason for hiding this comment

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

null or blank

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed.

@jerryshao jerryshao merged commit 517f66c into apache:main Sep 27, 2024
26 checks passed
@jerryshao
Copy link
Contributor

@jerqi this PR cannot be backported automatically, please help to do it manually.

jerqi added a commit to qqqttt123/gravitino that referenced this pull request Sep 27, 2024
support list group

support list group

Fix: apache#4873

no

UT

---------

Co-authored-by: Rory <[email protected]>
@LiuQhahah LiuQhahah deleted the #4873-Improvement-Group-supports-list-operations branch September 27, 2024 12:03
jerryshao pushed a commit that referenced this pull request Sep 27, 2024
### What changes were proposed in this pull request?
Supports to list groups.

### Why are the changes needed?

Fix: #4873 

### Does this PR introduce _any_ user-facing change?
I will add the document later.

### How was this patch tested?
UT.

Co-authored-by: Qiang-Liu <[email protected]>
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] Group supports list operations
4 participants