Skip to content

Commit

Permalink
Change type
Browse files Browse the repository at this point in the history
  • Loading branch information
jerqi committed Sep 23, 2024
1 parent c2c5c22 commit 7f5bf9b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
5 changes: 3 additions & 2 deletions core/src/main/java/org/apache/gravitino/EntityStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.function.Function;
import org.apache.gravitino.Entity.EntityType;
import org.apache.gravitino.exceptions.NoSuchEntityException;
Expand Down Expand Up @@ -65,7 +66,7 @@ public interface EntityStore extends Closeable {
*/
default <E extends Entity & HasIdentifier> List<E> list(
Namespace namespace, Class<E> type, EntityType entityType) throws IOException {
return list(namespace, type, entityType, Collections.emptyList());
return list(namespace, type, entityType, Collections.emptySet());
}

/**
Expand All @@ -86,7 +87,7 @@ default <E extends Entity & HasIdentifier> List<E> list(
* @throws IOException if the list operation fails
*/
default <E extends Entity & HasIdentifier> List<E> list(
Namespace namespace, Class<E> type, EntityType entityType, List<Field> skippingFields)
Namespace namespace, Class<E> type, EntityType entityType, Set<Field> skippingFields)
throws IOException {
throw new UnsupportedOperationException("Don't support to skip fields");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import org.apache.gravitino.Entity;
import org.apache.gravitino.EntityAlreadyExistsException;
import org.apache.gravitino.EntityStore;
Expand All @@ -40,6 +40,7 @@
import org.apache.gravitino.meta.UserEntity;
import org.apache.gravitino.storage.IdGenerator;
import org.apache.gravitino.utils.PrincipalUtils;
import org.glassfish.jersey.internal.guava.Sets;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -116,18 +117,20 @@ User getUser(String metalake, String user) throws NoSuchUserException {
}

String[] listUserNames(String metalake) {
return Arrays.stream(
listUsersInternal(
metalake, Lists.newArrayList(UserEntity.ROLE_NAMES, UserEntity.ROLE_IDS)))
Set<Field> skippingFields = Sets.newHashSet();
skippingFields.add(UserEntity.ROLE_NAMES);
skippingFields.add(UserEntity.ROLE_IDS);

return Arrays.stream(listUsersInternal(metalake, skippingFields))
.map(User::name)
.toArray(String[]::new);
}

User[] listUsers(String metalake) {
return listUsersInternal(metalake, Collections.emptyList());
return listUsersInternal(metalake, Collections.emptySet());
}

private User[] listUsersInternal(String metalake, List<Field> skippingFields) {
private User[] listUsersInternal(String metalake, Set<Field> skippingFields) {
try {
AuthorizationUtils.checkMetalakeExists(metalake);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.function.Function;
import org.apache.gravitino.Config;
import org.apache.gravitino.Configs;
Expand Down Expand Up @@ -96,7 +97,7 @@ public <E extends Entity & HasIdentifier> List<E> list(

@Override
public <E extends Entity & HasIdentifier> List<E> list(
Namespace namespace, Class<E> type, Entity.EntityType entityType, List<Field> skippingFields)
Namespace namespace, Class<E> type, Entity.EntityType entityType, Set<Field> skippingFields)
throws IOException {
return backend.list(namespace, entityType, skippingFields);
}
Expand Down

0 comments on commit 7f5bf9b

Please sign in to comment.