Search in sources :

Example 6 with RoleDDLDesc

use of org.apache.hadoop.hive.ql.plan.RoleDDLDesc in project hive by apache.

the class HiveAuthorizationTaskFactoryImpl method createShowRolePrincipalsTask.

@Override
public Task<? extends Serializable> createShowRolePrincipalsTask(ASTNode ast, Path resFile, HashSet<ReadEntity> inputs, HashSet<WriteEntity> outputs) throws SemanticException {
    String roleName;
    if (ast.getChildCount() == 1) {
        roleName = ast.getChild(0).getText();
    } else {
        // the parser should not allow this
        throw new AssertionError("Unexpected Tokens in SHOW ROLE PRINCIPALS");
    }
    RoleDDLDesc roleDDLDesc = new RoleDDLDesc(roleName, PrincipalType.ROLE, RoleOperation.SHOW_ROLE_PRINCIPALS, null);
    roleDDLDesc.setResFile(resFile.toString());
    return TaskFactory.get(new DDLWork(inputs, outputs, roleDDLDesc));
}
Also used : DDLWork(org.apache.hadoop.hive.ql.plan.DDLWork) RoleDDLDesc(org.apache.hadoop.hive.ql.plan.RoleDDLDesc)

Example 7 with RoleDDLDesc

use of org.apache.hadoop.hive.ql.plan.RoleDDLDesc in project hive by apache.

the class HiveAuthorizationTaskFactoryImpl method createCreateRoleTask.

@Override
public Task<? extends Serializable> createCreateRoleTask(ASTNode ast, HashSet<ReadEntity> inputs, HashSet<WriteEntity> outputs) {
    String roleName = BaseSemanticAnalyzer.unescapeIdentifier(ast.getChild(0).getText());
    RoleDDLDesc roleDesc = new RoleDDLDesc(roleName, PrincipalType.ROLE, RoleDDLDesc.RoleOperation.CREATE_ROLE, null);
    return TaskFactory.get(new DDLWork(inputs, outputs, roleDesc));
}
Also used : DDLWork(org.apache.hadoop.hive.ql.plan.DDLWork) RoleDDLDesc(org.apache.hadoop.hive.ql.plan.RoleDDLDesc)

Example 8 with RoleDDLDesc

use of org.apache.hadoop.hive.ql.plan.RoleDDLDesc in project hive by apache.

the class HiveAuthorizationTaskFactoryImpl method createShowRoleGrantTask.

@Override
public Task<? extends Serializable> createShowRoleGrantTask(ASTNode ast, Path resultFile, HashSet<ReadEntity> inputs, HashSet<WriteEntity> outputs) {
    ASTNode child = (ASTNode) ast.getChild(0);
    PrincipalType principalType = PrincipalType.USER;
    switch(child.getType()) {
        case HiveParser.TOK_USER:
            principalType = PrincipalType.USER;
            break;
        case HiveParser.TOK_GROUP:
            principalType = PrincipalType.GROUP;
            break;
        case HiveParser.TOK_ROLE:
            principalType = PrincipalType.ROLE;
            break;
    }
    String principalName = BaseSemanticAnalyzer.unescapeIdentifier(child.getChild(0).getText());
    RoleDDLDesc roleDesc = new RoleDDLDesc(principalName, principalType, RoleDDLDesc.RoleOperation.SHOW_ROLE_GRANT, null);
    roleDesc.setResFile(resultFile.toString());
    return TaskFactory.get(new DDLWork(inputs, outputs, roleDesc));
}
Also used : DDLWork(org.apache.hadoop.hive.ql.plan.DDLWork) ASTNode(org.apache.hadoop.hive.ql.parse.ASTNode) RoleDDLDesc(org.apache.hadoop.hive.ql.plan.RoleDDLDesc) PrincipalType(org.apache.hadoop.hive.metastore.api.PrincipalType)

Aggregations

RoleDDLDesc (org.apache.hadoop.hive.ql.plan.RoleDDLDesc)8 DDLWork (org.apache.hadoop.hive.ql.plan.DDLWork)6 PrincipalType (org.apache.hadoop.hive.metastore.api.PrincipalType)1 Hive (org.apache.hadoop.hive.ql.metadata.Hive)1 HiveException (org.apache.hadoop.hive.ql.metadata.HiveException)1 ASTNode (org.apache.hadoop.hive.ql.parse.ASTNode)1 AlterTablePartMergeFilesDesc (org.apache.hadoop.hive.ql.parse.AlterTablePartMergeFilesDesc)1 PreInsertTableDesc (org.apache.hadoop.hive.ql.parse.PreInsertTableDesc)1 AbortTxnsDesc (org.apache.hadoop.hive.ql.plan.AbortTxnsDesc)1 AddPartitionDesc (org.apache.hadoop.hive.ql.plan.AddPartitionDesc)1 AlterDatabaseDesc (org.apache.hadoop.hive.ql.plan.AlterDatabaseDesc)1 AlterTableAlterPartDesc (org.apache.hadoop.hive.ql.plan.AlterTableAlterPartDesc)1 AlterTableDesc (org.apache.hadoop.hive.ql.plan.AlterTableDesc)1 AlterTableExchangePartition (org.apache.hadoop.hive.ql.plan.AlterTableExchangePartition)1 AlterTableSimpleDesc (org.apache.hadoop.hive.ql.plan.AlterTableSimpleDesc)1 CacheMetadataDesc (org.apache.hadoop.hive.ql.plan.CacheMetadataDesc)1 CreateDatabaseDesc (org.apache.hadoop.hive.ql.plan.CreateDatabaseDesc)1 CreateTableDesc (org.apache.hadoop.hive.ql.plan.CreateTableDesc)1 CreateTableLikeDesc (org.apache.hadoop.hive.ql.plan.CreateTableLikeDesc)1 CreateViewDesc (org.apache.hadoop.hive.ql.plan.CreateViewDesc)1