use of com.facebook.presto.spi.security.PrincipalType in project presto by prestodb.
the class ThriftMetastoreUtil method fromMetastoreApiDatabase.
public static Database fromMetastoreApiDatabase(org.apache.hadoop.hive.metastore.api.Database database) {
String ownerName = "PUBLIC";
PrincipalType ownerType = ROLE;
if (database.getOwnerName() != null) {
ownerName = database.getOwnerName();
ownerType = fromMetastoreApiPrincipalType(database.getOwnerType());
}
Map<String, String> parameters = database.getParameters();
if (parameters == null) {
parameters = ImmutableMap.of();
}
return Database.builder().setDatabaseName(database.getName()).setLocation(Optional.ofNullable(database.getLocationUri())).setOwnerName(ownerName).setOwnerType(ownerType).setComment(Optional.ofNullable(database.getDescription())).setParameters(parameters).build();
}
Aggregations