Search in sources :

Example 16 with MTableColumnPrivilege

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

the class ObjectStore method listPrincipalTableColumnGrantsAll.

@Override
public List<HiveObjectPrivilege> listPrincipalTableColumnGrantsAll(String principalName, PrincipalType principalType) {
    boolean success = false;
    Query query = null;
    try {
        openTransaction();
        LOG.debug("Executing listPrincipalTableColumnGrantsAll");
        List<MTableColumnPrivilege> mSecurityTabPartList;
        if (principalName != null && principalType != null) {
            query = pm.newQuery(MTableColumnPrivilege.class, "principalName == t1 && principalType == t2");
            query.declareParameters("java.lang.String t1, java.lang.String t2");
            mSecurityTabPartList = (List<MTableColumnPrivilege>) query.execute(principalName, principalType.toString());
        } else {
            query = pm.newQuery(MTableColumnPrivilege.class);
            mSecurityTabPartList = (List<MTableColumnPrivilege>) query.execute();
        }
        LOG.debug("Done executing query for listPrincipalTableColumnGrantsAll");
        pm.retrieveAll(mSecurityTabPartList);
        List<HiveObjectPrivilege> result = convertTableCols(mSecurityTabPartList);
        success = commitTransaction();
        LOG.debug("Done retrieving all objects for listPrincipalTableColumnGrantsAll");
        return result;
    } finally {
        rollbackAndCleanup(success, query);
    }
}
Also used : HiveObjectPrivilege(org.apache.hadoop.hive.metastore.api.HiveObjectPrivilege) ScheduledQuery(org.apache.hadoop.hive.metastore.api.ScheduledQuery) Query(javax.jdo.Query) MScheduledQuery(org.apache.hadoop.hive.metastore.model.MScheduledQuery) MTableColumnPrivilege(org.apache.hadoop.hive.metastore.model.MTableColumnPrivilege)

Aggregations

MTableColumnPrivilege (org.apache.hadoop.hive.metastore.model.MTableColumnPrivilege)16 ArrayList (java.util.ArrayList)11 MPartitionColumnPrivilege (org.apache.hadoop.hive.metastore.model.MPartitionColumnPrivilege)8 MConstraint (org.apache.hadoop.hive.metastore.model.MConstraint)7 MPartitionPrivilege (org.apache.hadoop.hive.metastore.model.MPartitionPrivilege)7 MTable (org.apache.hadoop.hive.metastore.model.MTable)7 MTablePrivilege (org.apache.hadoop.hive.metastore.model.MTablePrivilege)7 Query (javax.jdo.Query)6 HiveObjectPrivilege (org.apache.hadoop.hive.metastore.api.HiveObjectPrivilege)6 SQLCheckConstraint (org.apache.hadoop.hive.metastore.api.SQLCheckConstraint)6 SQLDefaultConstraint (org.apache.hadoop.hive.metastore.api.SQLDefaultConstraint)6 SQLNotNullConstraint (org.apache.hadoop.hive.metastore.api.SQLNotNullConstraint)6 SQLUniqueConstraint (org.apache.hadoop.hive.metastore.api.SQLUniqueConstraint)6 ScheduledQuery (org.apache.hadoop.hive.metastore.api.ScheduledQuery)5 MScheduledQuery (org.apache.hadoop.hive.metastore.model.MScheduledQuery)5 LinkedList (java.util.LinkedList)4 List (java.util.List)4 ValidReaderWriteIdList (org.apache.hadoop.hive.common.ValidReaderWriteIdList)4 ValidWriteIdList (org.apache.hadoop.hive.common.ValidWriteIdList)4 HiveObjectRef (org.apache.hadoop.hive.metastore.api.HiveObjectRef)4