Search in sources :

Example 16 with MPartitionPrivilege

use of org.apache.hadoop.hive.metastore.model.MPartitionPrivilege in project hive by apache.

the class ObjectStore method getPartitionPrivilege.

private List<PrivilegeGrantInfo> getPartitionPrivilege(String dbName, String tableName, String partName, String principalName, PrincipalType principalType) {
    tableName = HiveStringUtils.normalizeIdentifier(tableName);
    dbName = HiveStringUtils.normalizeIdentifier(dbName);
    if (principalName != null) {
        List<MPartitionPrivilege> userNameTabPartPriv = this.listPrincipalMPartitionGrants(principalName, principalType, dbName, tableName, partName);
        if (userNameTabPartPriv != null && userNameTabPartPriv.size() > 0) {
            List<PrivilegeGrantInfo> grantInfos = new ArrayList<PrivilegeGrantInfo>(userNameTabPartPriv.size());
            for (int i = 0; i < userNameTabPartPriv.size(); i++) {
                MPartitionPrivilege item = userNameTabPartPriv.get(i);
                grantInfos.add(new PrivilegeGrantInfo(item.getPrivilege(), item.getCreateTime(), item.getGrantor(), getPrincipalTypeFromStr(item.getGrantorType()), item.getGrantOption()));
            }
            return grantInfos;
        }
    }
    return new ArrayList<PrivilegeGrantInfo>(0);
}
Also used : PrivilegeGrantInfo(org.apache.hadoop.hive.metastore.api.PrivilegeGrantInfo) MPartitionPrivilege(org.apache.hadoop.hive.metastore.model.MPartitionPrivilege) ArrayList(java.util.ArrayList) MConstraint(org.apache.hadoop.hive.metastore.model.MConstraint)

Aggregations

MPartitionPrivilege (org.apache.hadoop.hive.metastore.model.MPartitionPrivilege)16 ArrayList (java.util.ArrayList)11 MPartitionColumnPrivilege (org.apache.hadoop.hive.metastore.model.MPartitionColumnPrivilege)8 MConstraint (org.apache.hadoop.hive.metastore.model.MConstraint)7 MTable (org.apache.hadoop.hive.metastore.model.MTable)7 MTableColumnPrivilege (org.apache.hadoop.hive.metastore.model.MTableColumnPrivilege)7 MTablePrivilege (org.apache.hadoop.hive.metastore.model.MTablePrivilege)7 HiveObjectPrivilege (org.apache.hadoop.hive.metastore.api.HiveObjectPrivilege)6 LinkedList (java.util.LinkedList)5 List (java.util.List)5 Query (javax.jdo.Query)5 MPartition (org.apache.hadoop.hive.metastore.model.MPartition)5 MStringList (org.apache.hadoop.hive.metastore.model.MStringList)5 HiveObjectRef (org.apache.hadoop.hive.metastore.api.HiveObjectRef)4 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)3 PrincipalType (org.apache.hadoop.hive.metastore.api.PrincipalType)3 PrivilegeGrantInfo (org.apache.hadoop.hive.metastore.api.PrivilegeGrantInfo)3 MDBPrivilege (org.apache.hadoop.hive.metastore.model.MDBPrivilege)3 MDatabase (org.apache.hadoop.hive.metastore.model.MDatabase)3 MGlobalPrivilege (org.apache.hadoop.hive.metastore.model.MGlobalPrivilege)3