Search in sources :

Example 1 with CreateRoleDesc

use of org.apache.hadoop.hive.ql.ddl.privilege.role.create.CreateRoleDesc in project hive by apache.

the class HiveAuthorizationTaskFactoryImpl method createCreateRoleTask.

@Override
public Task<?> createCreateRoleTask(ASTNode ast, Set<ReadEntity> inputs, Set<WriteEntity> outputs) {
    String roleName = BaseSemanticAnalyzer.unescapeIdentifier(ast.getChild(0).getText());
    CreateRoleDesc createRoleDesc = new CreateRoleDesc(roleName);
    return TaskFactory.get(new DDLWork(inputs, outputs, createRoleDesc));
}
Also used : DDLWork(org.apache.hadoop.hive.ql.ddl.DDLWork) CreateRoleDesc(org.apache.hadoop.hive.ql.ddl.privilege.role.create.CreateRoleDesc)

Example 2 with CreateRoleDesc

use of org.apache.hadoop.hive.ql.ddl.privilege.role.create.CreateRoleDesc in project hive by apache.

the class TestHiveAuthorizationTaskFactory method testCreateRole.

/**
 * CREATE ROLE ...
 */
@Test
public void testCreateRole() throws Exception {
    DDLWork work = analyze("CREATE ROLE " + ROLE);
    CreateRoleDesc roleDesc = (CreateRoleDesc) work.getDDLDesc();
    Assert.assertNotNull("Role should not be null", roleDesc);
    Assert.assertEquals(ROLE, roleDesc.getName());
}
Also used : DDLWork(org.apache.hadoop.hive.ql.ddl.DDLWork) CreateRoleDesc(org.apache.hadoop.hive.ql.ddl.privilege.role.create.CreateRoleDesc) Test(org.junit.Test)

Aggregations

DDLWork (org.apache.hadoop.hive.ql.ddl.DDLWork)2 CreateRoleDesc (org.apache.hadoop.hive.ql.ddl.privilege.role.create.CreateRoleDesc)2 Test (org.junit.Test)1