Extract role name constants
@@ -139,6 +139,8 @@ import static org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Cate
public final class ThriftMetastoreUtil
{
+ private static final String PUBLIC_ROLE_NAME = "public";
+ private static final String ADMIN_ROLE_NAME = "admin";
private static final String NUM_FILES = "numFiles";
private static final String NUM_ROWS = "numRows";
private static final String RAW_DATA_SIZE = "rawDataSize";
@@ -279,7 +281,7 @@ public final class ThriftMetastoreUtil
Optional<SelectedRole> role = identity.getRole();
if (role.isPresent() && role.get().getType() == SelectedRole.Type.NONE) {
- return ImmutableSet.of("public");
+ return ImmutableSet.of(PUBLIC_ROLE_NAME);
}
PrestoPrincipal principal;
@@ -296,9 +298,9 @@ public final class ThriftMetastoreUtil
.collect(toSet());
// The admin role must be enabled explicitly. If it is, will be re-added below.
- roles.remove("admin");
+ roles.remove(ADMIN_ROLE_NAME);
- roles.add("public");
+ roles.add(PUBLIC_ROLE_NAME);
if (principal.getType() == ROLE) {
roles.add(principal.getName());
