use of org.apache.hadoop.hive.ql.scheduled.ScheduledQueryExecutionService in project hive by apache.
the class TestScheduledQueryIntegration method testScheduledQueryExecutionImpersonation.
@Test
public void testScheduledQueryExecutionImpersonation() throws ParseException, Exception {
envSetup.getTestCtx().hiveConf.setVar(HiveConf.ConfVars.HIVE_SCHEDULED_QUERIES_EXECUTOR_IDLE_SLEEP_TIME, "1s");
envSetup.getTestCtx().hiveConf.setVar(HiveConf.ConfVars.HIVE_SCHEDULED_QUERIES_EXECUTOR_PROGRESS_REPORT_INTERVAL, "1s");
setupAuthorization();
try (ScheduledQueryExecutionService schqS = ScheduledQueryExecutionService.startScheduledQueryExecutorService(envSetup.getTestCtx().hiveConf)) {
runAsUser("user1", "create scheduled query s1 cron '* * * * * ? *' defined as create table tx1 as select 12 as i", true);
Thread.sleep(20000);
}
// table exists - and owner is able to select from it
runAsUser("user1", "select * from tx1");
// other user can't drop it
try {
runAsUser("user2", "drop table tx1");
fail("should have failed");
} catch (CommandProcessorException cpe) {
assertEquals(40000, cpe.getResponseCode());
}
// but the owner can drop it
runAsUser("user1", "drop table tx1");
}
Aggregations